﻿[assembly: System.Web.UI.TagPrefix("GSC.WebControls", "GSC")]
namespace GSC.WebControls
{
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.Design.WebControls;
    using System.Drawing.Design;
    using System.Drawing;
    using System.Web.UI.Design;
    using System.ComponentModel;
    using System.Security.Permissions;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using ComponentModel.Design;
    /// <summary>
    /// 管理后台页面框架布局控件。
    /// </summary>
    /// <remarks>管理后台页面框架布局控件。</remarks>
    [ToolboxItemFilter("GSC.WebControls", ToolboxItemFilterType.Custom)]
    [ToolboxData("<{0}:BackgroundControl runat=server width=100%></{0}:BackgroundControl>")]
    [SRDescription("BackgroundControl", typeof(Properties.Resources))]
    [Designer(typeof(BackgroundControlDesigner))]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    //[PersistChildren(false)]
    //[DefaultProperty("HeadItems")]
    //[ParseChildren(true)]
    //[PersistChildren(true)]
    //[ToolboxBitmap(typeof(BackgroundHeadControl), "BackgroundHeadControl.bmp")] 
    public class BackgroundControl : CompositeControl, INamingContainer, ICompositeControlDesignerAccessor, IPostBackDataHandler, IUpdateAscx, IUpdateCulture, IAsyncControlIDsExtender, IUpdateMenu
    {
        #region static
        /// <summary>
        /// 获取页面的 GSC.WebControls.Manage.BackgroundControl 控件对象。
        /// </summary>
        /// <remarks>获取页面的 GSC.WebControls.BackgroundControl 控件对象。</remarks>
        /// <param name="page">设置当前页面对象。</param>
        /// <returns>GSC.WebControls.BackgroundControl</returns>
        public static BackgroundControl GetCurrent(Page page)
        {
            BackgroundControl control = null;
            foreach (Control item in page.Controls)
            {
                if (item is HtmlForm)
                {
                    foreach (Control citem in item.Controls)
                    {
                        if (citem is BackgroundControl)
                        {
                            control = (BackgroundControl)citem;
                            break;
                        }
                    }
                }
            }
            //if (control == null) throw new ArgumentNullException("没找到 BackgroundControl 控件错误!");
            return control;
        }
        /// <summary>
        /// 获取页面的 GSC.WebControls.Manage.BackgroundControl 控件对象。
        /// </summary>
        /// <remarks>获取页面的 GSC.WebControls.BackgroundControl 控件对象。</remarks>
        /// <param name="control">设置当前控件对象。</param>
        /// <returns>GSC.WebControls.BackgroundControl</returns>
        public static BackgroundControl GetCurrent(Control control)
        {
            BackgroundControl _control = null;
            foreach (Control item in control.Page.Controls)
            {
                if (item is HtmlForm)
                {
                    foreach (Control citem in item.Controls)
                    {
                        if (citem is BackgroundControl)
                        {
                            _control = (BackgroundControl)citem;
                            break;
                        }
                    }
                }
            }
            if (_control == null) throw new ArgumentNullException("没找到 BackgroundControl 控件错误!");
            return _control;
        }
        /// <summary>
        /// 获取页面的 GSC.WebControls.Manage.BackgroundControl 控件对象。
        /// </summary>
        /// <remarks>获取页面的 GSC.WebControls.Manage.BackgroundControl 控件对象。</remarks>
        /// <param name="master">设置当前页面模板对象。</param>
        /// <returns>GSC.WebControls.Manage.BackgroundControl</returns>
        public static BackgroundControl GetCurrent(MasterPage master)
        {
            BackgroundControl control = null;
            foreach (Control item in master.Controls)
            {
                if (item is HtmlForm)
                {
                    foreach (Control citem in item.Controls)
                    {
                        if (citem is BackgroundControl)
                        {
                            control = (BackgroundControl)citem;
                            break;
                        }
                    }
                }
            }
            if (control == null) throw new ArgumentNullException("没找到 BackgroundControl 控件错误!");
            return control;
        }
        #endregion
        #region IAsyncControlIDsExtender
        /// <summary>
        /// 
        /// </summary>
        List<string> IAsyncControlIDsExtender.ControlIDs
        {
            get
            {
                List<string> l = new List<string>();
                //if (this.AutomaticLoadControl)
                //{
                //
                foreach (BackgroundHeadControlItem item in this.HeadItems)
                {
                    //if (item.IsMenuBack || item.IsDefaultMenu)
                    //{
                    // l.Add(item.LinkButton.ClientID);
                    //}
                    //else
                    //{
                    //if (item.Ascx != string.Empty && item.Ascx.EndsWith(".ascx", StringComparison.InvariantCultureIgnoreCase))
                    //{
                    l.Add(item.LinkButton.ClientID);
                    //}
                    // }
                }
                //
                foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
                {
                    l.Add(item.Button.ClientID);
                    foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                    {
                        //if (citem.Ascx != string.Empty && citem.Ascx.EndsWith(".ascx", StringComparison.InvariantCultureIgnoreCase))
                        //{
                        l.Add(citem.Button.ClientID);
                        //}
                    }
                }
                //}
                return l;
            }
        }
        #endregion
        #region IUpdateCulture
        /// <summary>
        /// 使用更新区域接口，在加载控件存在次接口时同步更新。
        /// </summary>
        /// <remarks>使用更新区域接口，在加载控件存在次接口时同步更新。</remarks>
        public virtual void UpdateCulture()
        {
            if (this._currentAscx != null && this._currentAscx is IUpdateCulture)
            {
                ((IUpdateCulture)this._currentAscx).UpdateCulture();
            }
            if (this._currentMenuAscx != null && this._currentMenuAscx is IUpdateCulture)
            {
                ((IUpdateCulture)this._currentMenuAscx).UpdateCulture();
            }
        }
        #endregion
        #region IPostBackDataHandler
        /// <summary>
        /// 
        /// </summary>
        /// <param name="postDataKey"></param>
        /// <param name="postCollection"></param>
        /// <returns></returns>
        bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            return false;
        }
        /// <summary>
        /// 
        /// </summary>
        void IPostBackDataHandler.RaisePostDataChangedEvent()
        {
        }
        #endregion
        #region HeadControl
        /// <summary>
        /// 
        /// </summary>
        [ToolboxItem(false)]
        public sealed class HeadControl : Table, INamingContainer, IAsyncControlIDsExtender
        {
            #region IAsyncControlIDsExtender
            /// <summary>
            /// 
            /// </summary>
            List<string> IAsyncControlIDsExtender.ControlIDs
            {
                get
                {
                    List<string> ids = new List<string>();
                    if (this._owner.AutomaticLoadControl)
                    {
                        foreach (BackgroundHeadControlItem item in this._owner.HeadItems)
                        {
                            string asxc = item.Ascx;
                            if (asxc != string.Empty && asxc.EndsWith(".ascx", StringComparison.InvariantCultureIgnoreCase))
                            {
                                ids.Add(item.LinkButton.ClientID);
                            }
                            //if (string.IsNullOrEmpty(item.LinkButton.PostBackUrl)) { ids.Add(item.LinkButton.ClientID); }
                        }
                    }
                    return ids;
                }
            }
            #endregion
            internal BackgroundControl _owner;
            /// <summary>
            /// 
            /// </summary>
            /// <param name="owner"></param>
            public HeadControl(BackgroundControl owner)
            {
                this._owner = owner;
            }
            /// <summary>
            /// </summary>
            /// <param name="source"></param>
            /// <param name="args"></param>
            /// <returns></returns>
            protected override bool OnBubbleEvent(object source, EventArgs args)
            {
                if (args is CommandEventArgs)
                {
                    CommandEventArgs ce = (CommandEventArgs)args;
                    switch (ce.CommandName)
                    {
                        case "HeadLogout":
                            this._owner.OnHeadLogout(ce);
                            if (this._owner.HeadLogoutSessionName != string.Empty)
                            {
                                this.Page.Session.Remove(this._owner.HeadLogoutSessionName);
                                if (this._owner.HeadLogoutToUrl != string.Empty)
                                {
                                    this.Page.Response.Redirect(this._owner.HeadLogoutToUrl, true);
                                }
                            }
                            return true;
                        default:
                            //加载控件。
                            if (((Control)source).Parent is IAutomaticLoadControl)
                            {
                                IAutomaticLoadControl item = (IAutomaticLoadControl)((Control)source).Parent;
                                if (item.IsDefaultMenu)
                                {
                                    this._owner.DefaultUpdateMenuAscx();
                                }
                                else if (item.IsMenuBack)
                                {
                                    this._owner.LoadParentMenu();
                                }
                                else
                                {
                                    if (this._owner.AutomaticLoadControl && item.Ascx != string.Empty && item.Ascx.EndsWith(".ascx", StringComparison.InvariantCultureIgnoreCase))
                                    {
                                        this._owner.UpdateAscx(item.Ascx);
                                        if (this._owner.DefaultMenuAscx == string.Empty && this._owner.CenterLeftMenuTitles.Count > 0)
                                            this._owner.ResetDefault(false);
                                        else
                                        {
                                            foreach (Control citem in this._owner._currentMenuAscx.Controls)
                                            {
                                                if (citem is BackgroundCenterLeftMenuControl)
                                                {
                                                    ((BackgroundCenterLeftMenuControl)citem).ResetDefault();
                                                    this._owner._centerLeftUpdatePanel.Update();
                                                    break;
                                                }
                                                else if (citem is BackgroundCenterLeftButtonControl)
                                                {
                                                    ((BackgroundCenterLeftButtonControl)citem).ResetDefault();
                                                    this._owner._centerLeftUpdatePanel.Update();
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            this._owner.OnHeadItemClick(new BackgroundHeadControlItemClickEventArgs((BackgroundHeadControlItem)((Control)source).Parent, ce.CommandName, ce.CommandArgument));
                            return true;
                    }
                }
                return base.OnBubbleEvent(source, args);
            }
            /// <summary>
            /// </summary>
            /// <returns></returns>
            protected override object SaveViewState()
            {
                object[] oo = new object[] { base.SaveViewState(), null };
                //
                if (this._owner.HeadItems.Count > 0)
                {
                    oo[1] = ((IStateManager)this._owner.HeadItems).SaveViewState();
                }
                if (oo[0] == null && oo[1] == null) return null;
                return oo;
            }
            /// <summary>
            /// </summary>
            protected override void TrackViewState()
            {
                base.TrackViewState();
                ((IStateManager)this._owner.HeadItems).TrackViewState();
            }
            /// <summary>
            /// </summary>
            /// <param name="savedState"></param>
            protected override void LoadViewState(object savedState)
            {

                object[] oo = savedState as object[];
                if (oo != null)
                {
                    if (oo[0] != null)
                        base.LoadViewState(oo[0]);
                    if (oo[1] != null)
                        ((IStateManager)this._owner.HeadItems).LoadViewState(oo[1]);
                }
            }
            /// <summary>
            /// </summary>
            /// <param name="e"></param>
            protected override void OnInit(EventArgs e)
            {
                Page.RegisterRequiresControlState(this);
                base.OnInit(e);
            }
        }
        #endregion
        #region CenterLeftMenuControl
        /// <summary>
        /// 
        /// </summary>
        [ToolboxItem(false)]
        public sealed class CenterLeftMenuControl : Panel, IPostBackEventHandler, INamingContainer, IAsyncControlIDsExtender
        {
            #region IAsyncControlIDsExtender
            /// <summary>
            /// 
            /// </summary>
            List<string> IAsyncControlIDsExtender.ControlIDs
            {
                get
                {
                    List<string> ids = new List<string>();
                    foreach (BackgroundCenterLeftMenuTitleControl item in this._owner.CenterLeftMenuTitles)
                    {
                        foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                        {
                            string asxc = citem.Ascx;
                            if (asxc != string.Empty && asxc.EndsWith(".ascx", StringComparison.InvariantCultureIgnoreCase))
                            {
                                ids.Add(citem.Button.ClientID);
                            }
                            //if (string.IsNullOrEmpty(citem.Button.PostBackUrl)) { ids.Add(citem.Button.ClientID); }
                        }
                    }
                    return ids;
                }
            }
            #endregion
            /// <summary>
            /// 客户端pos事件处理
            /// </summary>
            /// <param name="eventArgument"></param>
            void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
            {
                this._owner.RaisePostBackEvent(eventArgument);
            }
            BackgroundControl _owner;
            /// <summary>
            /// 
            /// </summary>
            /// <param name="owner"></param>
            public CenterLeftMenuControl(BackgroundControl owner)
            {
                this._owner = owner;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="e"></param>
            protected override void OnPreRender(EventArgs e)
            {
                base.OnPreRender(e);
                this.Style["vertical-align"] = "top";
                this.Style["text-align"] = "left";
                this.Width = this._owner.CenterLeftWidth;
                this.Style["float"] = "left";
                this.Style["height"] = "auto";
                this.Style["overflow"] = "hidden";
                int b = 0;
                int a = 0;
                foreach (BackgroundCenterLeftMenuTitleControl item in this._owner.CenterLeftMenuTitles)
                {
                    //this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, "Title&" + a.ToString());
                    item.Button.Attributes["href"] = "javascript:__doPostBack('" + this.UniqueID + "','Title&" + a.ToString() + "')";
                    a++;
                    item.Button.CausesValidation = true;
                    item.Button.Text = item.Text;
                    //item.Button.ForeColor = item.ForeColor;
                    //item.Button.Font.CopyFrom(item.Font);
                    item.Button.ControlStyle.CopyFrom(item.ButtonStyle);
                    item.Button.CommandName = item.CommandName;
                    item.Button.CommandArgument = item.CommandArgument;
                    //
                    item.Style["overflow"] = "hidden";
                    item.Width = this._owner.Width;
                    //
                    item.TitleContainer.Style["background-position"] = "left top";
                    item.TitleContainer.Width = this._owner.Width;
                    item.TitleContainer.Height = this._owner.CenterLeftMenuTitleHeight;
                    if (string.IsNullOrEmpty(this._owner.CenterLeftMenuTitleBackImage))
                        item.TitleContainer.Style["background-image"] = "url(" + this._owner.ResolveClientUrl(this._owner.GetWebResourceUrl("BackgroundCenterLeftMenuControl.Images.TitleBg.gif")) + ")";
                    else
                        item.TitleContainer.Style["background-image"] = "url(" + this._owner.ResolveClientUrl(this._owner.CenterLeftMenuTitleBackImage) + ")";
                    //
                    item.IconContainer.Style["float"] = "left";
                    item.IconContainer.Style["padding-top"] = "5px";
                    item.IconContainer.Style["padding-left"] = "1px";
                    item.IconContainer.Style["font-size"] = "0px";
                    item.IconContainer.Style["overflow"] = "hidden";
                    //
                    if (item.IsExpanded)
                    {
                        if (this._owner.CenterLeftMenuExpandedIcon == string.Empty)
                            item.Icon.ImageUrl = this._owner.ResolveClientUrl(this._owner.GetWebResourceUrl("BackgroundCenterLeftMenuControl.Images.Expanded.gif"));
                        else
                            item.Icon.ImageUrl = this._owner.ResolveClientUrl(this._owner.CenterLeftMenuExpandedIcon);
                        //
                        item.ContentContainer.Style["display"] = "";
                    }
                    else
                    {
                        if (this._owner.CenterLeftMenuCollapseIcon == string.Empty)
                            item.Icon.ImageUrl = this._owner.ResolveClientUrl(this._owner.GetWebResourceUrl("BackgroundCenterLeftMenuControl.Images.Collapse.gif"));
                        else
                            item.Icon.ImageUrl = this._owner.ResolveClientUrl(this._owner.CenterLeftMenuCollapseIcon);
                        //
                        item.ContentContainer.Style["display"] = "none";
                    }
                    //
                    item.ButtonContainer.Style["float"] = "left";
                    int titleTextMarginTop = (int)this._owner.CenterLeftMenuTitleTextMarginTop.Value;
                    if (this.Page.Request.Browser.IsBrowser("IE"))
                    {
                        if (this.Page.Request.Browser.MajorVersion == 8)
                        {
                            item.ButtonContainer.Style["padding-top"] = (titleTextMarginTop + 3).ToString() + "px";
                        }
                        else if (this.Page.Request.Browser.MajorVersion == 7)
                        {
                            item.ButtonContainer.Style["padding-top"] = (titleTextMarginTop + 1).ToString() + "px";
                        }
                        else
                        {
                            item.ButtonContainer.Style["padding-top"] = titleTextMarginTop.ToString() + "px";
                        }
                    }
                    else if (this.Page.Request.Browser.IsBrowser("Opera"))
                    {
                        item.ButtonContainer.Style["padding-top"] = (titleTextMarginTop + 3).ToString() + "px";
                    }
                    else if (this.Page.Request.Browser.IsBrowser("Safari"))
                    {
                        item.ButtonContainer.Style["padding-top"] = (titleTextMarginTop + 1).ToString() + "px";
                    }
                    else
                    {
                        item.ButtonContainer.Style["padding-top"] = titleTextMarginTop.ToString() + "px";
                    }
                    item.ButtonContainer.Style["padding-left"] = "0px";
                    item.ButtonContainer.Style["font-size"] = "0px";
                    item.ButtonContainer.Style["overflow"] = "hidden";
                    //
                    if (!this._owner.CenterLeftMenuTitleTextWidth.IsEmpty)
                    {
                        item.Button.ToolTip = item.Text;
                        item.ButtonContainer.Style["white-space"] = "nowrap";
                        item.ButtonContainer.Style["text-overflow"] = "ellipsis";
                        item.ButtonContainer.Style["-o-text-overflow"] = "ellipsis";
                        item.ButtonContainer.Style["width"] = this._owner.CenterLeftMenuTitleTextWidth.ToString();
                    }
                    //
                    item.Button.Style["font-size"] = "14px";
                    item.Button.Style["font-weight"] = "bold";
                    //
                    item.ContentContainer.Width = item.Width;
                    //item.ContentContainer.Style["font-size"] = "0px";
                    if (item.Buttons.Count == 0)
                    {
                        item.ContentContainer.Height = Unit.Pixel(0);
                        item.ContentContainer.Style["display"] = "none";
                    }
                    //
                    foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                    {
                        //this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, "Button&" + b.ToString());
                        citem.Button.Attributes["href"] = "javascript:__doPostBack('" + this.UniqueID + "','Button&" + b.ToString() + "')";
                        b++;
                        //
                        citem.Button.CausesValidation = true;
                        citem.Style["overflow"] = "hidden";
                        citem.Style["background-position"] = "left top";
                        citem.Style["white-space"] = "nowrap";
                        citem.Style["text-overflow"] = "ellipsis";
                        citem.Height = this._owner.CenterLeftMenuButtonHeight;
                        citem.Width = this._owner.Width;
                        if (citem.IsSelected)
                            if (string.IsNullOrEmpty(this._owner.CenterLeftMenuSelectedButtonBackImage))
                                citem.Style["background-image"] = "url(" + this._owner.ResolveClientUrl(this._owner.GetWebResourceUrl("BackgroundCenterLeftMenuControl.Images.SelectedButtonBg.gif")) + ")";
                            else
                                citem.Style["background-image"] = "url(" + this._owner.ResolveClientUrl(this._owner.CenterLeftMenuSelectedButtonBackImage) + ")";
                        else
                            if (string.IsNullOrEmpty(this._owner.CenterLeftMenuButtonBackImage))
                            citem.Style["background-image"] = "url(" + this._owner.ResolveClientUrl(this._owner.GetWebResourceUrl("BackgroundCenterLeftMenuControl.Images.ButtonBg.gif")) + ")";
                        else
                            citem.Style["background-image"] = "url(" + this._owner.ResolveClientUrl(this._owner.CenterLeftMenuButtonBackImage) + ")";
                        //
                        citem.ButtonContainer.Height = this._owner.CenterLeftMenuButtonHeight;
                        citem.ButtonContainer.Width = this._owner.Width;
                        citem.ButtonContainer.Style["overflow"] = "hidden";
                        citem.ButtonContainer.Style["font-size"] = "0px";
                        citem.ButtonContainer.Style["padding-top"] = "5px";
                        citem.ButtonContainer.Style["padding-left"] = "4px";
                        //
                        citem.Button.Style["font-size"] = "12px";
                    }
                }
                //
                if (this._owner.CenterLeftMenuShowEnd)
                {
                    this._owner.CenterLeftMenuEnd.Visible = true;
                    this._owner.CenterLeftMenuEnd.Style["background-position"] = "left top";
                    this._owner.CenterLeftMenuEnd.Width = this._owner.Width;
                    this._owner.CenterLeftMenuEnd.Height = this._owner.CenterLeftMenuEndHeight;
                    if (string.IsNullOrEmpty(this._owner.CenterLeftMenuEndBackImage))
                        this._owner.CenterLeftMenuEnd.Style["background-image"] = "url(" + this._owner.ResolveClientUrl(this._owner.GetWebResourceUrl("BackgroundCenterLeftMenuControl.Images.EndBg.gif")) + ")";
                    else
                        this._owner.CenterLeftMenuEnd.Style["background-image"] = "url(" + this._owner.ResolveClientUrl(this._owner.CenterLeftMenuEndBackImage) + ")";
                }
                else
                {
                    this._owner.CenterLeftMenuEnd.Visible = false;
                }
            }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="writer"></param>
            protected override void Render(HtmlTextWriter writer)
            {
                this.EnsureChildControls();
                int b = 0;
                int a = 0;
                foreach (BackgroundCenterLeftMenuTitleControl item in this._owner.CenterLeftMenuTitles)
                {
                    this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, "Title&" + a.ToString());
                    a++;
                    foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                    {
                        this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, "Button&" + b.ToString());
                        b++;
                    }
                }
                if (Page != null)
                    Page.VerifyRenderingInServerForm(this);
                base.Render(writer);
            }
            /// <summary>
            /// </summary>
            /// <param name="savedState"></param>
            protected override void LoadViewState(object savedState)
            {
                Pair p = savedState as Pair;
                if (p.First != null)
                {
                    base.LoadViewState(p.First);
                }
                if (p.Second != null)
                {
                    ((IStateManager)this._owner.CenterLeftMenuTitles).LoadViewState(p.Second);
                }
            }
            /// <summary>
            /// </summary>
            /// <returns></returns>
            protected override object SaveViewState()
            {
                Pair p = new Pair();
                p.First = base.SaveViewState();
                p.Second = this._owner._centerLeftMenuTitles == null && this._owner._centerLeftMenuTitles.Count == 0 ? null : ((IStateManager)this._owner.CenterLeftMenuTitles).SaveViewState();
                return p;
            }
            /// <summary>
            /// </summary>
            protected override void TrackViewState()
            {
                base.TrackViewState();
                if (this._owner._centerLeftMenuTitles != null)
                {
                    ((IStateManager)this._owner._centerLeftMenuTitles).TrackViewState();
                }
            }
            /// <summary>
            /// </summary>
            /// <param name="e"></param>
            protected override void OnInit(EventArgs e)
            {
                //Page.RegisterRequiresControlState(this);
                base.OnInit(e);
            }
        }
        #endregion
        #region ICompositeControlDesignerAccessor
        void ICompositeControlDesignerAccessor.RecreateChildControls()
        {
            base.ChildControlsCreated = false;
            EnsureChildControls();
        }
        #endregion
        #region BackgroundHeadControl
        #region BackgroundHeadControl声明
        UpdatePanel _headUpdatePanel;
        private static readonly object _headItemClickObject = new object();
        private bool _headHasItem;
        private List<TableCell> _headItemCells;
        BackgroundHeadControlItemCollection _headItems = null;
        TemplateTableCellOwner _headLogoCell;
        ITemplate _headLogoTemplate;
        TemplateTableCellOwner _headLogoutCell;
        private static readonly object _headLogoutObject = new object();
        ITemplate _headLogoutTemplate;
        TableRow _headRow;
        private HeadControl _headTable;
        #endregion
        #region BackgroundHeadControl事件
        #region HeadExpansion
        /// <summary>
        /// 头对象按钮点击事件。
        /// </summary>
        /// <remarks>头对象按钮点击事件。</remarks>
        [Browsable(true)]
        [Category("Behavior")]
        [SRDescription("Manage_Master_HeadItemClick", typeof(Properties.Resources))]
        public event BackgroundHeadControlItemClickEventHandler HeadItemClick
        {
            add
            {
                Events.AddHandler(_headItemClickObject, value);
            }
            remove
            {
                Events.RemoveHandler(_headItemClickObject, value);
            }
        }
        /// <summary>
        /// 头对象按钮点击事件。
        /// </summary>
        /// <remarks>头对象按钮点击事件。</remarks>
        /// <param name="e"></param>
        protected virtual void OnHeadItemClick(BackgroundHeadControlItemClickEventArgs e)
        {
            BackgroundHeadControlItemClickEventHandler handler = (BackgroundHeadControlItemClickEventHandler)Events[_headItemClickObject];
            if (handler != null)
            {
                handler(this, e);
            }
        }
        #endregion
        #region HeadLogout
        /// <summary>
        /// 头部注销登录事件。
        /// </summary>
        /// <remarks>头部注销登录事件。</remarks>
        [Browsable(true)]
        [Category("Behavior")]
        [SRDescription("Manage_Master_HeadLogout", typeof(Properties.Resources))]
        public event CommandEventHandler HeadLogout
        {
            add
            {
                Events.AddHandler(_headLogoutObject, value);
            }
            remove
            {
                Events.RemoveHandler(_headLogoutObject, value);
            }
        }
        /// <summary>
        /// 注销登录事件。
        /// </summary>
        /// <remarks>注销登录事件。</remarks>
        /// <param name="e"></param>
        protected virtual void OnHeadLogout(CommandEventArgs e)
        {
            CommandEventHandler handler = (CommandEventHandler)Events[_headLogoutObject];
            if (handler != null)
            {
                handler(this, e);
            }
        }
        #endregion
        #endregion
        #region BackgroundHeadControl属性
        /// <summary>
        /// 获取头更新对象。
        /// </summary>
        /// <remarks>获取头更新对象。</remarks>
        /// <value>System.Web.UI.UpdatePanel</value>
        [Browsable(false)]
        public UpdatePanel HeadUpdatePanel
        {
            get
            {
                return _headUpdatePanel;
            }
        }
        /// <summary>
        /// 获取或设置头高度。
        /// </summary>
        /// <remarks>获取或设置头高度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "48px")]
        [DisplayName("HeadHeight")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_HeadHeight", typeof(Properties.Resources))]
        [SRCategory("BackgroundHeadControl")]
        public Unit HeadHeight
        {
            get
            {
                object o = this.ViewState["HeadHeight"];
                if (o == null) return Unit.Pixel(48);
                return (Unit)o;
            }
            set
            {
                this.ViewState["HeadHeight"] = value;
            }
        }
        /// <summary>
        /// 获取或设置头背景图片。
        /// </summary>
        /// <remarks>获取或设置头背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundHeadControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [DisplayName("BackImage")]
        [SRDescription("Manage_Master_HeadBackImage", typeof(Properties.Resources))]
        public string HeadBackImage
        {
            get
            {
                object o = this.ViewState["HeadBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["HeadBackImage"] = value;
            }
        }
        /// <summary>
        /// 获取或设置客户端登陆会话名称，在使用注销登录事件中使用。
        /// </summary>
        /// <remarks>获取或设置客户端登陆会话名称，在使用注销登录事件中使用。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Bindable(true)]
        [Browsable(true)]
        [SRCategory("BackgroundHeadControl")]
        [DisplayName("LogoutSessionName")]
        [SRDescription("Manage_Master_HeadLogoutSessionName", typeof(Properties.Resources))]
        public string HeadLogoutSessionName
        {
            get
            {
                object o = this.ViewState["HeadLogoutSessionName"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["HeadLogoutSessionName"] = value;
            }
        }
        /// <summary>
        /// 获取或设置头客户端注销登录后跳转页面地址。
        /// </summary>
        /// <remarks>获取或设置头客户端注销登录后跳转页面地址。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundHeadControl")]
        [DefaultValue("")]
        [Editor(typeof(UrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [DisplayName("LogoutToUrl")]
        [SRDescription("Manage_Master_HeadLogoutToUrl", typeof(Properties.Resources))]
        public string HeadLogoutToUrl
        {
            get
            {
                object o = this.ViewState["HeadLogoutToUrl"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["HeadLogoutToUrl"] = value;
            }
        }
        /// <summary>
        /// 获取头是否存在子对象。
        /// </summary>
        /// <remarks>获取头是否存在子对象。</remarks>
        /// <value>bool</value>
        [Browsable(false)]
        public bool HeadHasItem
        {
            get
            {
                return _headHasItem;
            }
        }
        /// <summary>
        /// 获取或设置头对象背景图片。
        /// </summary>
        /// <remarks>获取或设置头对象背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundHeadControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [DisplayName("ItemBackImage")]
        [SRDescription("Manage_Master_HeadItemBackImage", typeof(Properties.Resources))]
        public string HeadItemBackImage
        {
            get
            {
                object o = this.ViewState["HeadItemBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["HeadItemBackImage"] = value;
            }
        }

        /// <summary>
        /// 获取头按键例的集合。
        /// </summary>
        /// <remarks>获取头按键例的集合。</remarks>
        /// <value>GuoShuCan.SDK.Web.Controls.HeadItemCollection</value>
        [SRCategory("BackgroundHeadControl")]
        [
               PersistenceMode(PersistenceMode.InnerProperty),
               DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
               EditorAttribute(typeof(BackgroundHeadControlItemCollectionEditor), typeof(UITypeEditor)),
               NotifyParentProperty(true)
               ]
        [DisplayName("Items")]
        [SRDescription("Manage_Master_HeadItems", typeof(Properties.Resources))]
        public BackgroundHeadControlItemCollection HeadItems
        {
            get
            {
                if (_headItems == null)
                {
                    _headItems = new BackgroundHeadControlItemCollection();
                    if (IsTrackingViewState)
                    {
                        ((IStateManager)_headItems).TrackViewState();
                    }
                }
                return _headItems;
            }
        }

        /// <summary>
        /// 获取或设置钮对象宽度。
        /// </summary>
        /// <remarks>获取或设置钮对象宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [SRCategory("BackgroundHeadControl")]
        [Bindable(true)]
        [Browsable(true)]
        [DefaultValue(typeof(Unit), "68px")]
        [DisplayName("ItemWidth")]
        [SRDescription("Manage_Master_HeadItemWidth", typeof(Properties.Resources))]
        public virtual Unit HeadItemWidth
        {
            get
            {
                object o = this.ViewState["HeadItemWidth"];
                if (o == null) return Unit.Pixel(68);
                return (Unit)o;
            }
            set
            {
                this.ViewState["HeadItemWidth"] = value;
            }
        }
        /// <summary>
        /// 获取头对象例集合。
        /// </summary>
        /// <remarks>获取头对象例集合。</remarks>
        /// <value>System.Collections.Generic.List&lt;System.Web.UI.WebControls.TableCell&gt;</value>
        [Browsable(false)]
        public System.Collections.Generic.List<System.Web.UI.WebControls.TableCell> HeadItemCells
        {
            get
            {
                return _headItemCells;
            }
        }
        /// <summary>
        /// 获取或设置头 Logo 背景图片。
        /// </summary>
        /// <remarks>获取或设置头 Logo 背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundHeadControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [DisplayName("LogoBackImage")]
        [SRDescription("Manage_Master_HeadLogoBackImage", typeof(Properties.Resources))]
        public string HeadLogoBackImage
        {
            get
            {
                object o = this.ViewState["HeadLogoBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["HeadLogoBackImage"] = value;
            }
        }
        /// <summary>
        /// 获取或设置头 logo 模板对象。
        /// </summary>
        /// <remarks>获取或设置头 logo 模板对象。</remarks>
        /// <value>System.Web.UI.ITemplate</value>
        [
               Browsable(false),
               PersistenceMode(PersistenceMode.InnerProperty),
               DefaultValue(typeof(ITemplate), null),
               Description(""),
               TemplateContainer(typeof(BackgroundControl))
               ]
        public ITemplate HeadLogoTemplate
        {
            get
            {
                return _headLogoTemplate;
            }
            set
            {
                _headLogoTemplate = value;
            }
        }
        /// <summary>
        /// 获取头 Logo 例对象。
        /// </summary>
        /// <remarks>获取头 Logo 例对象。</remarks>
        /// <value>TemplateTableCellOwner</value>
        [Browsable(false)]
        public TemplateTableCellOwner HeadLogoCell
        {
            get
            {
                return _headLogoCell;
            }
        }
        /// <summary>
        /// 获取头 HeadLogout 例对象。
        /// </summary>
        /// <remarks>获取头 HeadLogout 例对象。</remarks>
        /// <value>GuoShuCan.SDK.Web.TemplateTableCellOwner</value>
        [Browsable(false)]
        public TemplateTableCellOwner HeadLogoutCell
        {
            get
            {
                return _headLogoutCell;
            }
        }
        /// <summary>
        /// 获取或设置头注销按钮图标。
        /// </summary>
        /// <remarks>获取或设置头注销按钮图标。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundHeadControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [DisplayName("LogoutImageUrl")]
        [SRDescription("Manage_Master_HeadLogoutImageUrl", typeof(Properties.Resources))]
        public string HeadLogoutImageUrl
        {
            get
            {
                object o = this.ViewState["HeadLogoutImageUrl"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["HeadLogoutImageUrl"] = value;
            }
        }
        /// <summary>
        /// 获取或设置头 Logout 模板对象。
        /// </summary>
        /// <remarks>获取或设置头 Logout 模板对象。</remarks>
        /// <value>System.Web.UI.ITemplate</value>
        [
                      Browsable(false),
                      PersistenceMode(PersistenceMode.InnerProperty),
                      DefaultValue(typeof(ITemplate), null),
                      Description(""),
                      TemplateContainer(typeof(BackgroundControl))
                      ]
        public ITemplate HeadLogoutTemplate
        {
            get
            {
                return _headLogoutTemplate;
            }
            set
            {
                _headLogoutTemplate = value;
            }
        }
        /// <summary>
        /// 获取或设置头内部上边位置。
        /// </summary>
        /// <remarks>获取或设置头内部上边位置。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [SRCategory("BackgroundHeadControl")]
        [Bindable(true)]
        [Browsable(true)]
        [DefaultValue(typeof(Unit), "22px")]
        [DisplayName("ItemPaddingTop")]
        [SRDescription("Manage_Master_HeadItemPaddingTop", typeof(Properties.Resources))]
        public virtual Unit HeadItemPaddingTop
        {
            get
            {
                object o = this.ViewState["HeadItemPaddingTop"];
                if (o == null) return Unit.Pixel(22);
                return (Unit)o;
            }
            set
            {
                this.ViewState["HeadItemPaddingTop"] = value;
            }
        }
        /// <summary>
        /// 获取头行对象。
        /// </summary>
        /// <remarks>获取头行对象。</remarks>
        /// <value>System.Web.UI.WebControls.TableRow</value>
        [Browsable(false)]
        public TableRow HeadRow
        {
            get
            {
                return _headRow;
            }
        }
        /// <summary>
        /// 获取或设置头 logo 宽度。
        /// </summary>
        /// <remarks>获取或设置头 logo 宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [SRCategory("BackgroundHeadControl")]
        [Bindable(true)]
        [Browsable(true)]
        [DefaultValue(typeof(Unit), "188px")]
        [DisplayName("LogoCellWidth")]
        [SRDescription("Manage_Master_HeadLogoCellWidth", typeof(Properties.Resources))]
        public virtual Unit HeadLogoCellWidth
        {
            get
            {
                object o = this.ViewState["HeadLogoCellWidth"];
                if (o == null) return Unit.Pixel(188);
                return (Unit)o;
            }
            set
            {
                this.ViewState["HeadLogoCellWidth"] = value;
            }
        }
        /// <summary>
        /// 获取或设置头菜单分隔背景图片。
        /// </summary>
        /// <remarks>获取或设置头菜单分隔背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundHeadControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [DisplayName("SecludeBackImage")]
        [SRDescription("Manage_Master_HeadSecludeBackImage", typeof(Properties.Resources))]
        public string HeadSecludeBackImage
        {
            get
            {
                object o = this.ViewState["HeadSecludeBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["HeadSecludeBackImage"] = value;
            }
        }
        /// <summary>
        /// 获取头控件表对象。
        /// </summary>
        /// <remarks>获取头控件表对象。</remarks>
        /// <value>GSC.WebControls.BackgroundControl.HeadControl</value>
        [Browsable(false)]
        public HeadControl HeadTable
        {
            get
            {
                return _headTable;
            }
        }
        #endregion
        #endregion
        void HeadPreRender(object o, EventArgs e)
        {
            //
            string l = System.Threading.Thread.CurrentThread.CurrentCulture.Name.Replace("-", "_");
            this._headTable.Style["vertical-align"] = "top";
            this._headTable.Style["text-align"] = "left";
            this._headTable.GridLines = GridLines.None;
            this._headTable.Style["overflow"] = "visible";
            this._headTable.CellPadding = 0;
            this._headTable.CellSpacing = 0;
            this._headTable.BorderWidth = 0;
            if (!this.CenterWidth.IsEmpty)
            {
                HeadTable.Style["min-width"] = this.CenterWidth.ToString();
                if (this.Page.Request.Browser.IsBrowser("IE"))
                {
                    if (this.Page.Request.Browser.MajorVersion == 6)
                    {
                        HeadTable.Style["width"] = "expression(document.documentElement.clientWidth < " + this.CenterWidth.Value.ToString() + " ? '" + this.CenterWidth.ToString() + "' : '100%')";
                    }
                    else if (this.Page.Request.Browser.MajorVersion == 7)
                    {
                        HeadTable.Style["width"] = "expression(document.body.clientWidth < " + this.CenterWidth.Value.ToString() + " ? '" + this.CenterWidth.ToString() + "' : '100%')";
                    }
                    else if (this.Page.Request.Browser.MajorVersion >= 8)
                    {
                        HeadTable.Width = Width;
                    }
                }
                else if (this.Page.Request.Browser.IsBrowser("Safari"))
                {
                    //HeadTable.Style["width"] = "expression(Math.min(window.innerWidth, document.body.clientWidth) < " + this.CenterWidth.Value.ToString() + " ? '" + this.CenterWidth.ToString() + "' : '100%')";
                    HeadTable.Width = Width;
                }
                else
                {
                    HeadTable.Width = Width;
                }
            }
            else
            {
                HeadTable.Width = Width;
            }
            HeadTable.Height = HeadHeight;
            this.HeadTable.Style["table-layout"] = "fixed";
            this.HeadTable.Style["background-repeat"] = "repeat-x";
            if (string.IsNullOrEmpty(HeadBackImage))
                this.HeadTable.Style["background-image"] = "url(" + ResolveClientUrl(GetWebResourceUrl("BackgroundHeadControl.Images.bg.gif")) + ")";
            else
                this.HeadTable.Style["background-image"] = "url(" + ResolveClientUrl(HeadBackImage) + ")";
            //
            HeadRow.Height = HeadHeight;
            //
            this.HeadLogoCell.Height = HeadHeight;
            this.HeadLogoCell.Width = this.HeadLogoCellWidth;//Unit.Pixel(188);
            this.HeadLogoCell.Style["overflow"] = "hidden";
            this.HeadLogoCell.Style["background-repeat"] = "no-repeat";
            this.HeadLogoCell.Style["text-align"] = "left";
            if (string.IsNullOrEmpty(HeadLogoBackImage))
                this.HeadLogoCell.Style["background-image"] = "url(" + ResolveClientUrl(GetWebResourceUrl("BackgroundHeadControl.Images.logobg.gif")) + ")";
            else
                this.HeadLogoCell.Style["background-image"] = "url(" + ResolveClientUrl(HeadLogoBackImage) + ")";
            //
            foreach (TableCell cell in HeadItemCells)
            {
                cell.Height = HeadHeight;
                cell.Width = HeadItemWidth;
                cell.Style["text-align"] = "left";
                cell.Style["overflow"] = "hidden";
                cell.Style["background-repeat"] = "repeat-x";
                cell.Style["background-position"] = "left top";
                //cell.Style["font-size"] = "0px";
                if (string.IsNullOrEmpty(HeadItemBackImage))
                    cell.Style["background-image"] = "url(" + ResolveClientUrl(GetWebResourceUrl("BackgroundHeadControl.Images.itembg.gif")) + ")";
                else
                    cell.Style["background-image"] = "url(" + ResolveClientUrl(HeadItemBackImage) + ")";
            }
            foreach (BackgroundHeadControlItem item in HeadItems)
            {
                //((ICompositeControlDesignerAccessor)item).RecreateChildControls();
                item.Height = HeadHeight;
                item.Width = HeadItemWidth;
                item.Style["text-align"] = "center";
                item.Style["overflow"] = "hidden";
                item.Style["background-repeat"] = "no-repeat";
                item.Style["background-position"] = "left top";
                if (string.IsNullOrEmpty(HeadSecludeBackImage))
                    item.Style["background-image"] = "url(" + ResolveClientUrl(GetWebResourceUrl("BackgroundHeadControl.Images.seclude.gif")) + ")";
                else
                    item.Style["background-image"] = "url(" + ResolveClientUrl(HeadSecludeBackImage) + ")";
                //
                //item.TopPanel.Height = HeadItemPaddingTop;
                if (this.Page.Request.Browser.Browser.Equals("Firefox", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (this.HeadItemPaddingTop.IsEmpty)
                        item.TopPanel.Height = this.HeadItemPaddingTop;
                    else
                        item.TopPanel.Height = Unit.Pixel((int)(this.HeadItemPaddingTop.Value - 3));
                }
                else
                {
                    item.TopPanel.Height = this.HeadItemPaddingTop;
                }
                item.TopPanel.Style["overflow"] = "hidden";
                item.TopPanel.Style["font-size"] = "0px";
                //
            }
            //
            this.HeadLogoutCell.Height = HeadHeight;
            this.HeadLogoutCell.Style["width"] = "auto";
            //this.LogoutCell.Style["word-wrap"] = "keep-all";
            this.HeadLogoutCell.Style["background-repeat"] = "no-repeat";
            this.HeadLogoutCell.Style["background-position"] = "left top";
            this.HeadLogoutCell.Style["vertical-align"] = "middle";
            this.HeadLogoutCell.Style["text-align"] = "right";
            this.HeadLogoutCell.Style["padding-right"] = "8px";
            this.HeadLogoutCell.Style["padding-left"] = "8px";
            this.HeadLogoutCell.Style["overflow"] = "hidden";
            if (string.IsNullOrEmpty(HeadSecludeBackImage))
                this.HeadLogoutCell.Style["background-image"] = "url(" + ResolveClientUrl(GetWebResourceUrl("BackgroundHeadControl.Images.seclude.gif")) + ")";
            else
                this.HeadLogoutCell.Style["background-image"] = "url(" + ResolveClientUrl(HeadSecludeBackImage) + ")";
            foreach (Control item in this.HeadLogoutCell.Controls)
            {
                if (item is ImageButton && ((ImageButton)item).CommandName == "HeadLogout")
                {
                    if (string.IsNullOrEmpty(this.HeadLogoutImageUrl))
                    {
                        ((ImageButton)item).ImageUrl = this.GetWebResourceUrl("BackgroundHeadControl.Images." + l + ".logout.gif");
                    }
                    else
                    {
                        ((ImageButton)item).ImageUrl = this.HeadLogoutImageUrl;
                    }
                    break;
                }
            }
        }
        void CenterHeadTablePreRender(object o, EventArgs e)
        {
            //
            this._centerHeadTable.Style["vertical-align"] = "top";
            this._centerHeadTable.Style["text-align"] = "left";
            this._centerHeadTable.CellPadding = 0;
            this._centerHeadTable.CellSpacing = 0;
            this._centerHeadTable.GridLines = GridLines.None;
            //CenterHeadTable.BackColor = BackColor;
            //CenterHeadTable.BorderColor = BorderColor;
            //CenterHeadTable.BorderStyle = BorderStyle;
            //CenterHeadTable.BorderWidth = BorderWidth;
            if (this.CenterWidth.IsEmpty)
                this._centerHeadTable.Width = Width;
            else
                this._centerHeadTable.Width = CenterWidth;
            this._centerHeadTable.Height = CenterHeadHeight;
            this._centerHeadTable.Style["table-layout"] = "fixed";
            this._centerHeadTable.Style["overflow"] = "hidden";
            /*
            CenterHeadMenuCell.Height = CenterHeadHeight;
            CenterHeadMenuCell.Width = CenterHeadMenuCellWidth;// Unit.Pixel(150);
            CenterHeadMenuCell.Style["overflow"] = "hidden";
            CenterHeadMenuCell.Style["background-position"] = "left top";
            if (string.IsNullOrEmpty(CenterHeadMenuCellBackImage))
                this.CenterHeadMenuCell.Style["background-image"] = "url(" + ResolveClientUrl(GetWebResourceUrl("BackgroundCenterHeadControl.Images.Menu.gif")) + ")";
            else
                this.CenterHeadMenuCell.Style["background-image"] = "url(" + ResolveClientUrl(CenterHeadMenuCellBackImage) + ")";
            */
            CenterHeadLeftCell.Height = CenterHeadHeight;
            CenterHeadLeftCell.Width = CenterHeadLeftCellWidth;
            CenterHeadLeftCell.Style["overflow"] = "hidden";
            CenterHeadLeftCell.Style["background-position"] = "left top";
            if (string.IsNullOrEmpty(CenterHeadLeftCellBackImage))
                this.CenterHeadLeftCell.Style["background-image"] = "url(" + ResolveClientUrl(GetWebResourceUrl("BackgroundCenterHeadControl.Images.Left.gif")) + ")";
            else
                this.CenterHeadLeftCell.Style["background-image"] = "url(" + ResolveClientUrl(CenterHeadLeftCellBackImage) + ")";
            //
            CenterHeadCenterCell.Height = CenterHeadHeight;
            if (CenterHeadCenterCellWidth.IsEmpty)
                CenterHeadCenterCell.Style["width"] = "auto";
            else
                CenterHeadCenterCell.Width = CenterHeadCenterCellWidth;
            CenterHeadCenterCell.Style["overflow"] = "hidden";
            CenterHeadCenterCell.Style["background-position"] = "left top";
            if (string.IsNullOrEmpty(CenterHeadCenterCellBackImage))
                this.CenterHeadCenterCell.Style["background-image"] = "url(" + ResolveClientUrl(GetWebResourceUrl("BackgroundCenterHeadControl.Images.Center.gif")) + ")";
            else
                this.CenterHeadCenterCell.Style["background-image"] = "url(" + ResolveClientUrl(CenterHeadCenterCellBackImage) + ")";
            //
            CenterHeadRightCell.Height = CenterHeadHeight;
            CenterHeadRightCell.Width = CenterHeadRightCellWidth;
            CenterHeadRightCell.Style["overflow"] = "hidden";
            CenterHeadRightCell.Style["background-position"] = "left top";
            if (string.IsNullOrEmpty(CenterHeadRightCellBackImage))
                this.CenterHeadRightCell.Style["background-image"] = "url(" + ResolveClientUrl(GetWebResourceUrl("BackgroundCenterHeadControl.Images.Right.gif")) + ")";
            else
                this.CenterHeadRightCell.Style["background-image"] = "url(" + ResolveClientUrl(CenterHeadRightCellBackImage) + ")";
        }
        void CenterPreRender(object o, EventArgs e)
        {
            this.Center.Style["text-align"] = "left";
            this.Center.Style["vertical-align"] = "top";
            this.Center.CellPadding = 0;
            this.Center.CellSpacing = 0;
            this.Center.BorderWidth = 0;
            if (this.CenterWidth.IsEmpty)
            {

            }
            else
                this.Center.Width = this.CenterWidth;
            //this.Center.Style["height"] = "auto";
            //this.Center.Width = Unit.Pixel((int)(this.CenterLeftWidth.Value + this.CenterRightWidth.Value));
        }
        void CenterLeftPreRender(object o, EventArgs e)
        {
            this.CenterLeft.Width = this.CenterLeftWidth;
            //this.CenterLeft.Style["float"] = "left";
            this.CenterLeft.Style["height"] = "auto";
            this.CenterLeft.Style["vertical-align"] = "top";
            this.CenterLeft.Style["text-align"] = "left";
            //this.CenterLeft.Style["overflow"] = "hidden";
        }
        void CenterRightPreRender(object o, EventArgs e)
        {
            this.BackgroundCenterRightControl.Style["background-color"] = "#ffffff";
            //this.BackgroundCenterRightControl.Width = this.CenterRightWidth;
            if (!this.CenterRightContainerPaddingBottom.IsEmpty)
                this.BackgroundCenterRightControl.Style["padding-_bottom"] = this.CenterRightContainerPaddingBottom.ToString();
            if (!this.CenterRightContainerPaddingLeft.IsEmpty)
                this.BackgroundCenterRightControl.Style["padding-left"] = this.CenterRightContainerPaddingLeft.ToString();
            if (!this.CenterRightContainerPaddingRight.IsEmpty)
                this.BackgroundCenterRightControl.Style["padding-right"] = this.CenterRightContainerPaddingRight.ToString();
            if (!this.CenterRightContainerPaddingTop.IsEmpty)
                this.BackgroundCenterRightControl.Style["padding-top"] = this.CenterRightContainerPaddingTop.ToString();
            this.BackgroundCenterRightControl.Style["vertical-align"] = "top";
            this.BackgroundCenterRightControl.Style["text-align"] = "left";
            //
            this.BackgroundCenterRightControl.Style["background-position"] = "right top";
            this.BackgroundCenterRightControl.Style["background-repeat"] = "repeat-y";
            if (string.IsNullOrEmpty(this.CenterRightBackImage))
                this.BackgroundCenterRightControl.Style["background-image"] = "url(" + this.ResolveClientUrl(this.GetWebResourceUrl("BackgroundCenterRightControl.Images.bg.gif")) + ")";
            else
                this.BackgroundCenterRightControl.Style["background-image"] = "url(" + this.ResolveClientUrl(this.CenterRightBackImage) + ")";
            this.BackgroundCenterRightControl.Style["overflow"] = "hidden";
            this._centerRightContainer.Style["font-size"] = "12px";
            this._centerRightContainer.Style["overflow"] = "hidden";
            this._centerRightContainer.Style["height"] = "auto";
            if (!this.CenterWidth.IsEmpty)
            {
                this._centerRightContainer.Style["width"] = (this.CenterWidth.Value - (this.CenterLeftWidth.IsEmpty ? 0 : this.CenterLeftWidth.Value) - (this.CenterRightContainerPaddingLeft.IsEmpty ? 0 : this.CenterRightContainerPaddingLeft.Value) - (this.CenterRightContainerPaddingRight.IsEmpty ? 0 : this.CenterRightContainerPaddingRight.Value)).ToString() + "px";
            }
            //if (!this.CenterRightWidth.IsEmpty)
            //{
            //    this._centerRightContainer.Style["width"] = (this.CenterRightWidth.Value - (this.CenterRightContainerPaddingLeft.IsEmpty ? 0 : this.CenterRightContainerPaddingLeft.Value) - (this.CenterRightContainerPaddingRight.IsEmpty ? 0 : this.CenterRightContainerPaddingRight.Value)).ToString() + "px";
            //}
            //this._centerRightContainer.Style["background-color"] = "#FFFFCC";
        }
        void CenterEndTablePreRender(object o, EventArgs e)
        {
            this.CenterEndTable.Style["vertical-align"] = "top";
            this.CenterEndTable.Style["text-align"] = "left";
            this.CenterEndTable.CellPadding = 0;
            this.CenterEndTable.CellSpacing = 0;
            this.CenterEndTable.GridLines = GridLines.None;
            this.CenterEndTable.BorderWidth = Unit.Pixel(0);
            if (this.CenterWidth.IsEmpty)
                this.CenterEndTable.Width = this.Width;
            else
                this.CenterEndTable.Width = this.CenterWidth;
            //this._Master.CenterEndTable.BackColor = this._Master.BackColor;
            //this._Master.CenterEndTable.BorderColor = this._Master.BorderColor;
            //this._Master.CenterEndTable.BorderStyle = this._Master.BorderStyle;
            //this._Master.CenterEndTable.BorderWidth = this._Master.BorderWidth;
            this.CenterEndTable.Height = this.CenterEndHeight;
            this.CenterEndTable.Style["table-layout"] = "fixed";
            this.CenterEndTable.Style["overflow"] = "hidden";
            /*
            this.CenterEndMenuCell.Height = this.Height;
            this.CenterEndMenuCell.Width = this.CenterEndMenuCellWidth;
            this.CenterEndMenuCell.Style["overflow"] = "hidden";
            this.CenterEndMenuCell.Style["background-position"] = "left top";
            if (string.IsNullOrEmpty(this.CenterEndMenuCellBackImage))
                this.CenterEndMenuCell.Style["background-image"] = "url(" + this.ResolveClientUrl(this.GetWebResourceUrl("BackgroundCenterEndControl.Images.Menu.gif")) + ")";
            else
                this.CenterEndMenuCell.Style["background-image"] = "url(" + this.ResolveClientUrl(this.CenterEndMenuCellBackImage) + ")";
            */
            this.CenterEndLeftCell.Height = this.Height;
            this.CenterEndLeftCell.Width = this.CenterEndLeftCellWidth;
            this.CenterEndLeftCell.Style["overflow"] = "hidden";
            this.CenterEndLeftCell.Style["background-position"] = "left top";
            if (string.IsNullOrEmpty(this.CenterEndLeftCellBackImage))
                this.CenterEndLeftCell.Style["background-image"] = "url(" + this.ResolveClientUrl(this.GetWebResourceUrl("BackgroundCenterEndControl.Images.Left.gif")) + ")";
            else
                this.CenterEndLeftCell.Style["background-image"] = "url(" + this.ResolveClientUrl(this.CenterEndLeftCellBackImage) + ")";
            //
            this.CenterEndCenterCell.Height = this.Height;
            if (this.CenterEndCenterCellWidth.IsEmpty)
                this.CenterEndCenterCell.Style["width"] = "auto";
            else
                this.CenterEndCenterCell.Width = this.CenterEndCenterCellWidth;
            this.CenterEndCenterCell.Style["overflow"] = "hidden";
            this.CenterEndCenterCell.Style["background-position"] = "left top";
            if (string.IsNullOrEmpty(this.CenterEndCenterCellBackImage))
                this.CenterEndCenterCell.Style["background-image"] = "url(" + this.ResolveClientUrl(this.GetWebResourceUrl("BackgroundCenterEndControl.Images.Center.gif")) + ")";
            else
                this.CenterEndCenterCell.Style["background-image"] = "url(" + this.ResolveClientUrl(this.CenterEndCenterCellBackImage) + ")";
            //
            this.CenterEndRightCell.Height = this.Height;
            this.CenterEndRightCell.Width = this.CenterEndRightCellWidth;
            this.CenterEndRightCell.Style["overflow"] = "hidden";
            this.CenterEndRightCell.Style["background-position"] = "left top";
            if (string.IsNullOrEmpty(this.CenterEndRightCellBackImage))
                this.CenterEndRightCell.Style["background-image"] = "url(" + this.ResolveClientUrl(this.GetWebResourceUrl("BackgroundCenterEndControl.Images.Right.gif")) + ")";
            else
                this.CenterEndRightCell.Style["background-image"] = "url(" + this.ResolveClientUrl(this.CenterEndRightCellBackImage) + ")";
        }
        void CopyrightPreRender(object o, EventArgs e)
        {
            if (!this.CenterWidth.IsEmpty)
            {
                this._copyright.Width = this.CenterWidth;
                //this._copyright.Style["min-width"] = this.CenterWidth.ToString();
            }
            else
            {
                this._copyright.Width = this.Width;
            }
            this._copyright.CellPadding = 0;
            this._copyright.CellSpacing = 0;
            this._copyright.BorderWidth = Unit.Pixel(0);
            this._copyright.Style["vertical-align"] = "top";
            this._copyright.Style["text-align"] = "left";
            this._copyright.Style["table-layout"] = "fixed";
            //this._copyright.Style["overflow"] = "hidden";
            this._copyright.Height = this.CopyrightHeight;
            this._copyright.Style["background-position"] = "center";
            this._copyright.Style["background-repeat"] = "no-repeat";
            if (string.IsNullOrEmpty(this.CopyrightBackImage))
                this._copyright.Style["background-image"] = "url(" + this.ResolveClientUrl(this.GetWebResourceUrl("BackgroundCopyrightControl.Images.BackgroundCopyrightControl.gif")) + ")";
            else
                this._copyright.Style["background-image"] = "url(" + this.ResolveClientUrl(this.CopyrightBackImage) + ")";
            //
            this._copyrightCell.Style["width"] = "auto";
        }
        UpdatePanel _centerHeadLeftCellUpdatePanel;
        UpdatePanel _centerHeadCenterCellUpdatePanel;
        /// <summary>
        /// 获取中间头部左边更新容器对象。
        /// </summary>
        /// <remarks>获取中间头部左边更新容器对象。</remarks>
        /// <value>System.Web.UI.UpdatePanel</value>
        [Browsable(false)]
        public UpdatePanel CenterHeadLeftCellUpdatePanel
        {
            get
            {
                if (_centerHeadLeftCellUpdatePanel == null && this._centerHeadLeftCellTemplate == null)
                {
                    _centerHeadLeftCellUpdatePanel = new UpdatePanel();
                }
                return _centerHeadLeftCellUpdatePanel;
            }
        }
        /// <summary>
        /// 获取中间头部中间更新容器对象。
        /// </summary>
        /// <remarks>获取中间头部中间更新容器对象。</remarks>
        /// <value>System.Web.UI.UpdatePanel</value>
        [Browsable(false)]
        public UpdatePanel CenterHeadCenterCellUpdatePanel
        {
            get
            {
                if (_centerHeadCenterCellUpdatePanel == null && this._centerHeadCenterCellTemplate == null)
                {
                    _centerHeadCenterCellUpdatePanel = new UpdatePanel();
                }
                return _centerHeadCenterCellUpdatePanel;
            }
        }
        /// <summary>
        /// </summary>
        protected virtual void CreateControlHierarchy()
        {
            #region BackgroundHeadControl
            if (!this.DesignMode)
            {
                _headUpdatePanel = new UpdatePanel();
                _headUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
                _headUpdatePanel.ID = "HeadUpdatePanel";
                _headUpdatePanel.ContentTemplateContainer.ID = "HeadContentTemplateContainer";
            }
            _headTable = new HeadControl(this);
            _headTable.PreRender += new EventHandler(HeadPreRender);
            _headTable.ID = "HeadTable";
            _headHasItem = this.HeadItems.Count > 0;
            //创建行。
            _headRow = new TableRow();
            _headRow.ID = "HeadRow";
            _headTable.Rows.Add(this._headRow);
            //创建logo例。
            _headLogoCell = new TemplateTableCellOwner();
            _headLogoCell.ID = "HeadLogoCell";
            _headRow.Cells.Add(this._headLogoCell);
            //创建logo例模板。
            ITemplate tempLogo = _headLogoTemplate;
            if (tempLogo == null)
            {
                tempLogo = new DefaultEmptyTemplate();
            }
            tempLogo.InstantiateIn(this._headLogoCell);
            //创建item例。
            _headItemCells = new List<TableCell>();
            int i = 0;
            foreach (BackgroundHeadControlItem item in this.HeadItems)
            {
                TableCell cell = new TableCell();
                cell.ID = "HeadItemCell" + i.ToString();
                _headItemCells.Add(cell);
                cell.Controls.Add(item);
                _headRow.Cells.Add(cell);
                i++;
            }
            //
            //创建logout例。
            _headLogoutCell = new TemplateTableCellOwner();
            _headLogoutCell.ID = "HeadLogoutCell";
            _headRow.Cells.Add(this._headLogoutCell);
            //创建logo例模板。
            ITemplate tempLogout = _headLogoutTemplate;
            if (tempLogout == null)
            {
                tempLogout = new BackgroundControlHeadLogoutDefaultTemplate();
            }
            tempLogout.InstantiateIn(this._headLogoutCell);
            //
            this._headLogoCell.DataBind();
            this._headLogoutCell.DataBind();
            if (this.DesignMode)
            {
                this.Controls.Add(this._headTable);
            }
            else
            {
                this._headUpdatePanel.ContentTemplateContainer.Controls.Add(this._headTable);
                this.Controls.Add(this._headUpdatePanel);
            }
            #endregion
            #region Center
            #region BackgroundHeadControl
            if (!this.DesignMode)
            {
                _centerHeadUpdatePanel = new UpdatePanel();
                _centerHeadUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
                _centerHeadUpdatePanel.ID = "CenterHeadUpdatePanel";
            }
            this._centerHeadTable = new Table();
            this._centerHeadTable.ID = "CenterHeadTable";
            this._centerHeadTable.PreRender += new EventHandler(CenterHeadTablePreRender);
            _centerHeadRow = new TableRow();
            _centerHeadRow.ID = "CenterHeadRow";
            _centerHeadTable.Rows.Add(this._centerHeadRow);
            //
            _centerHeadLeftCell = new TemplateTableCellOwner();
            _centerHeadLeftCell.ID = "CenterHeadLeft";
            //
            _centerHeadCenterCell = new TemplateTableCellOwner();
            _centerHeadCenterCell.ID = "CenterHeadCenter";
            //
            _centerHeadRightCell = new TemplateTableCellOwner();
            _centerHeadRightCell.ID = "CenterHeadRight";
            //
            ITemplate temp = this._centerHeadLeftCellTemplate;
            if (temp == null)
            {
                if (this.DesignMode)
                {
                    temp = new DefaultEmptyTemplate();
                    temp.InstantiateIn(this._centerHeadLeftCell);
                }
                else
                {
                    if (this._centerHeadLeftCellUpdatePanel == null)
                    {
                        this._centerHeadLeftCellUpdatePanel = new UpdatePanel();
                    }
                    this._centerHeadLeftCellUpdatePanel.ID = "UpdatePanel";
                    this._centerHeadLeftCellUpdatePanel.UpdateMode = this.CenterHeadLeftUpdateMode;
                    this._centerHeadLeftCellUpdatePanel.RenderMode = this.CenterHeadLeftRenderMode;
                    this._centerHeadLeftCell.Controls.Add(this._centerHeadLeftCellUpdatePanel);
                }
            }
            else
            {
                temp.InstantiateIn(this._centerHeadLeftCell);
            }
            //
            temp = this._centerHeadCenterCellTemplate;
            if (temp == null)
            {
                if (this.DesignMode)
                {
                    temp = new DefaultEmptyTemplate();
                    temp.InstantiateIn(this._centerHeadCenterCell);
                }
                else
                {
                    if (this._centerHeadCenterCellUpdatePanel == null)
                    {
                        this._centerHeadCenterCellUpdatePanel = new UpdatePanel();
                    }
                    this._centerHeadCenterCellUpdatePanel.ID = "UpdatePanel";
                    this._centerHeadCenterCellUpdatePanel.UpdateMode = this.CenterHeadCenterUpdateMode;
                    this._centerHeadCenterCellUpdatePanel.RenderMode = this.CenterHeadCenterRenderMode;
                    this._centerHeadCenterCell.Controls.Add(this._centerHeadCenterCellUpdatePanel);
                }
            }
            else
            {
                temp.InstantiateIn(this._centerHeadCenterCell);
            }
            //
            this._centerHeadRow.Cells.Add(this._centerHeadLeftCell);
            this._centerHeadRow.Cells.Add(this._centerHeadCenterCell);
            this._centerHeadRow.Cells.Add(this._centerHeadRightCell);
            //
            if (this.DesignMode)
            {
                this.Controls.Add(this._centerHeadTable);
            }
            else
            {
                this._centerHeadUpdatePanel.ContentTemplateContainer.Controls.Add(this._centerHeadTable);
                this.Controls.Add(this._centerHeadUpdatePanel);
            }
            //
            this._centerHeadLeftCell.DataBind();
            this._centerHeadCenterCell.DataBind();
            //this._centerHeadRightCell.DataBind();
            #endregion
            #region Center
            #region Center
            this._center = new Table();
            this._center.ID = "Center";
            this._center.PreRender += new EventHandler(CenterPreRender);
            this._centerRow = new TableRow();
            this._centerRow.ID = "CenterRow";
            this._center.Rows.Add(this._centerRow);
            if (this.DesignMode)
            {
                this.Controls.Add(this._center);
            }
            else
            {
                this._centerUpdatePanel = new UpdatePanel();
                this._centerUpdatePanel.ID = "CenterUpdatePanel";
                this._centerUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
                this._centerUpdatePanel.ContentTemplateContainer.Controls.Add(this._center);
                this._centerUpdatePanel.ContentTemplateContainer.ID = "CenterContentTemplateContainer";
                this.Controls.Add(this._centerUpdatePanel);
            }
            #endregion
            #region CenterLeft
            this._centerLeft = new TableCell();
            this._centerLeft.ID = "CenterLeftCell";
            this._centerLeft.PreRender += new EventHandler(CenterLeftPreRender);
            this._centerRow.Cells.Add(this._centerLeft);
            #region BackgroundCenterLeftMenuControl
            //验证是否存在动态加载菜单对象。
            if (this.DefaultMenuAscx == string.Empty && this.CenterLeftMenuTitles.Count > 0)
            {
                //不动态加载菜单。
                this._centerLeftMenu = new CenterLeftMenuControl(this);
                this._centerLeftMenu.ID = "BackgroundCenterLeftMenuControl";
                //
                foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
                {
                    ((ICompositeControlDesignerAccessor)item).RecreateChildControls();
                    this._centerLeftMenu.Controls.Add(item);
                    foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                    {
                        ((ICompositeControlDesignerAccessor)citem).RecreateChildControls();
                    }
                }
                //
                this._centerLeftMenuEnd = new Panel();
                this._centerLeftMenuEnd.ID = "CenterLeftMenuEnd";
                this._centerLeftMenu.Controls.Add(this._centerLeftMenuEnd);
                //
                if (this.DesignMode)
                {
                    this._centerLeft.Controls.Add(this._centerLeftMenu);
                }
                else
                {
                    this._centerLeftUpdatePanel = new UpdatePanel();
                    this._centerLeftUpdatePanel.ID = "CenterLeftUpdatePanel";
                    this._centerLeftUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
                    this._centerLeftUpdatePanel.ContentTemplateContainer.ID = "CenterLeftContentTemplateContainer";
                    this._centerLeftUpdatePanel.ContentTemplateContainer.Controls.Add(this._centerLeftMenu);
                    this._centerLeft.Controls.Add(this._centerLeftUpdatePanel);
                }
            }
            else
            {
                if (!this.DesignMode)
                {
                    //动态加载菜单。
                    if (_centerLeftPlaceHolder == null)
                        this._centerLeftPlaceHolder = new PlaceHolder();
                    this._centerLeftPlaceHolder.ID = "CenterLeftPlaceHolder";
                    //
                    this._centerLeftUpdatePanel = new UpdatePanel();
                    this._centerLeftUpdatePanel.ID = "CenterLeftUpdatePanel";
                    this._centerLeftUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
                    this._centerLeftUpdatePanel.ContentTemplateContainer.ID = "CenterLeftContentTemplateContainer";
                    this._centerLeftUpdatePanel.ContentTemplateContainer.Controls.Add(this._centerLeftPlaceHolder);
                    this._centerLeft.Controls.Add(this._centerLeftUpdatePanel);
                }
            }
            #endregion
            #endregion
            #region BackgroundCenterRightControl
            this._centerRight = new TableCell();
            this._centerRight.ID = "CenterRightCell";
            this._centerRight.PreRender += new EventHandler(this.CenterRightPreRender);
            this._centerRow.Cells.Add(this._centerRight);
            //
            this._centerRightContainer = new Panel();
            this._centerRightContainer.ID = "CenterRightContainer";
            if (_centerRightPlaceHolder == null)
                this._centerRightPlaceHolder = new PlaceHolder();
            //20091021
            //this._centerRightPlaceHolder.EnableViewState = false;
            this._centerRightPlaceHolder.ID = "CenterRightPlaceHolder";
            if (this.DesignMode)
            {
                this._centerRightContainer.Controls.Add(this._centerRightPlaceHolder);
            }
            else
            {
                this._centerRightUpdatePanel = new UpdatePanel();
                this._centerRightUpdatePanel.ID = "CenterRightUpdatePanel";
                this._centerRightUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
                this._centerRightUpdatePanel.ContentTemplateContainer.ID = "CenterRightContentTemplateContainer";
                this._centerRightUpdatePanel.ContentTemplateContainer.Controls.Add(this._centerRightPlaceHolder);
                this._centerRightContainer.Controls.Add(this._centerRightUpdatePanel);
            }
            this._centerRight.Controls.Add(this._centerRightContainer);
            #region BackgroundCenterEndControl
            this._centerEndTable = new Table();
            this._centerEndTable.PreRender += new EventHandler(CenterEndTablePreRender);
            this._centerEndTable.ID = "CenterEndTable";
            this._centerEndRow = new TableRow();
            this._centerEndRow.ID = "CenterEndRow";
            this._centerEndTable.Rows.Add(this._centerEndRow);
            //
            this._centerEndLeftCell = new TableCell();
            this._centerEndLeftCell.ID = "CenterEndLeft";
            //
            this._centerEndCenterCell = new TableCell();
            this._centerEndCenterCell.ID = "CenterEndCenter";
            //
            this._centerEndRightCell = new TableCell();
            this._centerEndRightCell.ID = "CenterEndRight";
            //
            this._centerEndRow.Cells.Add(this._centerEndLeftCell);
            this._centerEndRow.Cells.Add(this._centerEndCenterCell);
            this._centerEndRow.Cells.Add(this._centerEndRightCell);
            //
            if (this.DesignMode)
                this.Controls.Add(this._centerEndTable);
            else
            {
                this._centerEndUpdatePanel = new UpdatePanel();
                this._centerEndUpdatePanel.ID = "CenterEndUpdatePanel";
                this._centerEndUpdatePanel.ContentTemplateContainer.ID = "CenterEndContentTemplateContainer";
                this._centerEndUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
                this._centerEndUpdatePanel.ContentTemplateContainer.Controls.Add(this._centerEndTable);
                this.Controls.Add(this._centerEndUpdatePanel);
            }
            #endregion
            #endregion
            #endregion
            #endregion
            #region BackgroundCopyrightControl
            //
            this._copyright = new Table();
            this._copyright.PreRender += new EventHandler(CopyrightPreRender);
            this._copyright.ID = "BackgroundCopyrightControl";
            //
            this._copyrightRow = new TableRow();
            this._copyrightRow.ID = "CopyrightRow";
            this._copyright.Rows.Add(this._copyrightRow);
            //
            this._copyrightCell = new TableCell();
            this._copyrightCell.ID = "CopyrightCell";
            this._copyrightRow.Cells.Add(this._copyrightCell);
            //
            if (this._copyrightContentTemplate == null)
                this._copyrightContentTemplate = new DefaultEmptyTemplate();
            this._copyrightContentTemplate.InstantiateIn(this._copyrightCell);
            if (this.DesignMode)
                this.Controls.Add(this._copyright);
            else
            {
                this._copyrightUpdatePanel = new UpdatePanel();
                this._copyrightUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
                this._copyrightUpdatePanel.ID = "CopyrightUpdatePanel";
                this._copyrightUpdatePanel.ContentTemplateContainer.ID = "CopyrightContentTemplateContainer";
                this._copyrightUpdatePanel.ContentTemplateContainer.Controls.Add(this._copyright);
                this.Controls.Add(this._copyrightUpdatePanel);
            }
            #endregion
            //
            this.OnCreateChildControl(EventArgs.Empty);
        }
        /// <summary>
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();
            CreateControlHierarchy();
            ClearChildViewState();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            this.Style["font-size"] = "0px";
            this.Style["text-align"] = "left";
            this.Style["vertical-align"] = "top";
            this.Style["background-position"] = "left top";
            this.Style["background-repeat"] = "repeat-x";
            if (string.IsNullOrEmpty(this.BackImageUrl))
                this.Style["background-image"] = "url(" + this.ResolveClientUrl(this.GetWebResourceUrl("BackgroundControl.Images.body.gif")) + ")";
            else
                this.Style["background-image"] = "url(" + this.ResolveClientUrl(this.BackImageUrl) + ")";
            this.Style["background-color"] = System.Drawing.ColorTranslator.ToHtml(this.BackColor);
            //
            this._headLogoutCell.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Right;
            //
            this.Page.RegisterRequiresPostBack(this);
        }
        /// <summary>
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            if (Page != null)
                Page.VerifyRenderingInServerForm(this);
            base.Render(writer);
        }
        /// <summary>
        /// </summary>
        /// <param name="obj"></param>
        protected override void AddParsedSubObject(object obj)
        {
            if (obj is BackgroundHeadControlItem)
            {
                this.HeadItems.Add((BackgroundHeadControlItem)obj);
                return;
            }
            else if (obj is BackgroundCenterLeftMenuTitleControl)
            {
                this.CenterLeftMenuTitles.Add((BackgroundCenterLeftMenuTitleControl)obj);
                return;
            }
        }
        /// <summary>
        /// 设计时获取资源文件地址。
        /// </summary>
        /// <remarks>设计时获取资源文件地址。</remarks>
        /// <returns>string</returns>
        internal virtual string GetWebResourceUrl(string resourceUrl)
        {
            if (this.Page == null) return string.Empty;
            if (this.Page.ClientScript == null) return string.Empty;
            return this.Page.ClientScript.GetWebResourceUrl(typeof(BackgroundControl), "GSC.WebControls." + resourceUrl);
        }
        /// <summary>
        /// </summary>
        protected override HtmlTextWriterTag TagKey
        {
            get
            {
                return HtmlTextWriterTag.Div;
            }
        }
        /// <summary>
        /// </summary>
        protected override string TagName
        {
            get
            {
                return "div";
            }
        }
        #region Center
        #region BackgroundCenterHeadControl
        #region BackgroundCenterHeadControl声明
        UpdatePanel _centerHeadUpdatePanel;
        /// <summary>
        /// 
        /// </summary>
        private Table _centerHeadTable;
        /// <summary>
        /// 
        /// </summary>
        TableRow _centerHeadRow;
        /// <summary>
        /// 
        /// </summary>
        private TemplateTableCellOwner _centerHeadRightCell;
        /// <summary>
        /// 
        /// </summary>
        ITemplate _centerHeadLeftCellTemplate;
        /// <summary>
        /// 
        /// </summary>
        private TemplateTableCellOwner _centerHeadLeftCell;
        /// <summary>
        /// 
        /// </summary>
        ITemplate _centerHeadCenterCellTemplate;
        /// <summary>
        /// 
        /// </summary>
        private TemplateTableCellOwner _centerHeadCenterCell;
        #endregion
        #region BackgroundCenterHeadControl属性
        /// <summary>
        /// 获取中间头部更新对象。
        /// </summary>
        /// <remarks>获取中间头部更新对象。</remarks>
        /// <value>System.Web.UI.UpdatePanel</value>
        [Browsable(false)]
        public UpdatePanel CenterHeadUpdatePanel
        {
            get
            {
                return _centerHeadUpdatePanel;
            }
        }
        /// <summary>
        /// 获取中间头部中间例对象。
        /// </summary>
        /// <remarks>获取中间头部中间例对象。</remarks>
        /// <value>TemplateTableCellOwner</value>
        [Browsable(false)]
        public TemplateTableCellOwner CenterHeadCenterCell
        {
            get
            {
                return _centerHeadCenterCell;
            }
        }
        /// <summary>
        /// 获取或设置中间头部中间例背景图片。
        /// </summary>
        /// <remarks>获取或设置中间头部中间例背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundCenterHeadControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [DisplayName("CenterCellBackImage")]
        [SRDescription("Manage_Master_CenterHeadCenterCellBackImage", typeof(Properties.Resources))]
        public string CenterHeadCenterCellBackImage
        {
            get
            {
                object o = this.ViewState["CenterHeadCenterCellBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterHeadCenterCellBackImage"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间头部中间例模板。
        /// </summary>
        /// <remarks>获取或设置中间头部中间例模板。</remarks>
        /// <value>System.Web.UI.ITemplate</value>
        [
                                    Browsable(false),
                                    PersistenceMode(PersistenceMode.InnerProperty),
                                    DefaultValue(typeof(ITemplate), null),
                                    Description(""),
                                    TemplateContainer(typeof(BackgroundControl))
                                    ]
        public ITemplate CenterHeadCenterCellTemplate
        {
            get
            {
                return _centerHeadCenterCellTemplate;
            }
            set
            {
                _centerHeadCenterCellTemplate = value;
            }
        }

        /// <summary>
        /// 获取或设置中间头部中间例宽度。
        /// </summary>
        /// <remarks>获取或设置中间头部中间例宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "Empty")]
        [SRCategory("BackgroundCenterHeadControl")]
        [DisplayName("CenterCellWidth")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterHeadCenterCellWidth", typeof(Properties.Resources))]
        public Unit CenterHeadCenterCellWidth
        {
            get
            {
                object o = this.ViewState["CenterHeadCenterCellWidth"];
                if (o == null) return Unit.Empty;
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterHeadCenterCellWidth"] = value;
            }
        }

        /// <summary>
        /// 获取中间头部左边例对象。
        /// </summary>
        /// <remarks>获取中间头部左边例对象。</remarks>
        /// <value>GuoShuCan.SDK.Web.TemplatePanelOwner</value>
        [Browsable(false)]
        public TemplateTableCellOwner CenterHeadLeftCell
        {
            get
            {
                return _centerHeadLeftCell;
            }
        }

        /// <summary>
        /// 获取或设置中间头部左边例背景图片。
        /// </summary>
        /// <remarks>获取或设置中间头部左边例背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundCenterHeadControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [DisplayName("LeftCellBackImage")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterHeadLeftCellBackImage", typeof(Properties.Resources))]
        public string CenterHeadLeftCellBackImage
        {
            get
            {
                object o = this.ViewState["CenterHeadLeftCellBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterHeadLeftCellBackImage"] = value;
            }
        }

        /// <summary>
        /// 获取或设置中间头部左边例模板。
        /// </summary>
        /// <remarks>获取或设置中间头部左边例模板。</remarks>
        /// <value>System.Web.UI.ITemplate</value>
        [
                             Browsable(false),
                             PersistenceMode(PersistenceMode.InnerProperty),
                             DefaultValue(typeof(ITemplate), null),
                             Description(""),
                             TemplateContainer(typeof(BackgroundControl))
                             ]
        public ITemplate CenterHeadLeftCellTemplate
        {
            get
            {
                return _centerHeadLeftCellTemplate;
            }
            set
            {
                _centerHeadLeftCellTemplate = value;
            }
        }

        /// <summary>
        /// 获取或设置中间头部左边例宽度。
        /// </summary>
        /// <remarks>获取或设置中间头部左边例宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "800px")]
        [SRCategory("BackgroundCenterHeadControl")]
        [DisplayName("LeftCellWidth")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterHeadLeftCellWidth", typeof(Properties.Resources))]
        public Unit CenterHeadLeftCellWidth
        {
            get
            {
                object o = this.ViewState["CenterHeadLeftCellWidth"];
                if (o == null) return Unit.Pixel(800);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterHeadLeftCellWidth"] = value;
            }
        }

        /// <summary>
        /// 获取中间头部右边例对象。
        /// </summary>
        /// <remarks>获取中间头部右边例对象。</remarks>
        /// <value>TemplateTableCellOwner</value>
        [Browsable(false)]
        public TemplateTableCellOwner CenterHeadRightCell
        {
            get
            {
                return _centerHeadRightCell;
            }
        }
        /// <summary>
        /// 获取或设置中间头部右边例背景图片。
        /// </summary>
        /// <remarks>获取或设置中间头部右边例背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundCenterHeadControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [DisplayName("RightCellBackImage")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterHeadRightCellBackImage", typeof(Properties.Resources))]
        public string CenterHeadRightCellBackImage
        {
            get
            {
                object o = this.ViewState["CenterHeadRightCellBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterHeadRightCellBackImage"] = value;
            }
        }

        /// <summary>
        /// 获取或设置中间头部右边例宽度。
        /// </summary>
        /// <remarks>获取或设置中间头部右边例宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "28px")]
        [SRCategory("BackgroundCenterHeadControl")]
        [DisplayName("RightCellWidth")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterHeadRightCellWidth", typeof(Properties.Resources))]
        public Unit CenterHeadRightCellWidth
        {
            get
            {
                object o = this.ViewState["CenterHeadRightCellWidth"];
                if (o == null) return Unit.Pixel(28);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterHeadRightCellWidth"] = value;
            }
        }

        /// <summary>
        /// 获取中间头部行对象。
        /// </summary>
        /// <remarks>获取中间头部行对象。</remarks>
        /// <value>System.Web.UI.WebControls.TableRow</value>
        [Browsable(false)]
        public TableRow CenterHeadRow
        {
            get
            {
                return _centerHeadRow;
            }
        }

        /// <summary>
        /// 获取中间头部表对象。
        /// </summary>
        /// <remarks>获取中间头部表对象。</remarks>
        /// <value>System.Web.UI.WebControls.Table</value>
        [Browsable(false)]
        public System.Web.UI.WebControls.Table CenterHeadTable
        {
            get
            {
                return _centerHeadTable;
            }
        }
        /// <summary>
        /// 获取或设置中间头部高度。
        /// </summary>
        /// <remarks>获取或设置中间头部高度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "30px")]
        [SRCategory("BackgroundCenterHeadControl")]
        [DisplayName("CenterHeadHeight")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterHeadHeight", typeof(Properties.Resources))]
        public Unit CenterHeadHeight
        {
            get
            {
                object o = this.ViewState["CenterHeadHeight"];
                if (o == null) return Unit.Pixel(30);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterHeadHeight"] = value;
            }
        }
        #endregion
        #region Center
        /// <summary>
        /// 获取中间右边容器内部上边距离。
        /// </summary>
        /// <remarks>获取中间右边容器内部上边距离。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "")]
        [SRCategory("BackgroundCenterRightControl")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterRightContainerPaddingTop", typeof(Properties.Resources))]
        public Unit CenterRightContainerPaddingTop
        {
            get
            {
                object o = this.ViewState["CenterRightContainerPaddingTop"];
                if (o == null) return Unit.Empty;
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterRightContainerPaddingTop"] = value;
            }
        }
        /// <summary>
        /// 获取中间右边容器内部左边距离。
        /// </summary>
        /// <remarks>获取中间右边容器内部左边距离。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "8px")]
        [SRCategory("BackgroundCenterRightControl")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterRightContainerPaddingLeft", typeof(Properties.Resources))]
        public Unit CenterRightContainerPaddingLeft
        {
            get
            {
                object o = this.ViewState["CenterRightContainerPaddingLeft"];
                if (o == null) return Unit.Pixel(8);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterRightContainerPaddingLeft"] = value;
            }
        }
        /// <summary>
        /// 获取中间右边容器内部下边距离。
        /// </summary>
        /// <remarks>获取中间右边容器内部下边距离。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "")]
        [SRCategory("BackgroundCenterRightControl")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterRightContainerPaddingBottom", typeof(Properties.Resources))]
        public Unit CenterRightContainerPaddingBottom
        {
            get
            {
                object o = this.ViewState["CenterRightContainerPaddingBottom"];
                if (o == null) return Unit.Empty;
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterRightContainerPaddingBottom"] = value;
            }
        }
        /// <summary>
        /// 获取中间右边容器内部右边距离。
        /// </summary>
        /// <remarks>获取中间右边容器内部右边距离。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "12px")]
        [SRCategory("BackgroundCenterRightControl")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterRightContainerPaddingRight", typeof(Properties.Resources))]
        public Unit CenterRightContainerPaddingRight
        {
            get
            {
                object o = this.ViewState["CenterRightContainerPaddingRight"];
                if (o == null) return Unit.Pixel(12);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterRightContainerPaddingRight"] = value;
            }
        }
        UpdatePanel _centerUpdatePanel;
        /// <summary>
        /// 获取中间更新对象。
        /// </summary>
        /// <remarks>获取中间更新对象。</remarks>
        /// <value>System.Web.UI.UpdatePanel</value>
        [Browsable(false)]
        public UpdatePanel CenterUpdatePanel
        {
            get
            {
                return _centerUpdatePanel;
            }
        }
        /// <summary>
        /// 获取中间对象。
        /// </summary>
        /// <remarks>获取中间对象。</remarks>
        /// <value>System.Web.UI.WebControls.Table</value>
        [Browsable(false)]
        public Table Center
        {
            get
            {
                return _center;
            }
        }
        private Table _center;
        /// <summary>
        /// 获取或设置中间宽度。
        /// </summary>
        /// <remarks>获取或设置中间宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "980px")]
        [SRCategory("Center")]
        [DisplayName("CenterWidth")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterWidth", typeof(Properties.Resources))]
        public Unit CenterWidth
        {
            get
            {
                object o = this.ViewState["CenterWidth"];
                if (o == null) return Unit.Pixel(980);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterWidth"] = value;
            }
        }
        /// <summary>
        /// 获取中间左边对象。
        /// </summary>
        /// <remarks>获取中间左边对象。</remarks>
        /// <value>System.Web.UI.WebControls.TableCell</value>
        [Browsable(false)]
        public TableCell CenterLeft
        {
            get
            {
                return _centerLeft;
            }
        }
        private TableCell _centerLeft;
        UpdatePanel _centerLeftUpdatePanel;
        /// <summary>
        /// 获取中间左边更新对象。
        /// </summary>
        /// <remarks>获取中间左边更新对象。</remarks>
        /// <value>System.Web.UI.UpdatePanel</value>
        [Browsable(false)]
        public UpdatePanel CenterLeftUpdatePanel
        {
            get
            {
                return _centerLeftUpdatePanel;
            }
        }
        /// <summary>
        /// 获取中间右边对象。
        /// </summary>
        /// <remarks>获取中间右边对象。</remarks>
        /// <value>System.Web.UI.WebControls.TableCell</value>
        [Browsable(false)]
        public TableCell BackgroundCenterRightControl
        {
            get
            {
                return _centerRight;
            }
        }
        private TableCell _centerRight;
        TableRow _centerRow;
        /// <summary>
        /// 获取中间行对象。
        /// </summary>
        /// <remarks>获取中间行对象。</remarks>
        /// <value>System.Web.UI.WebControls.TableRow</value>
        [Browsable(false)]
        public TableRow CenterRow
        {
            get
            {
                return _centerRow;
            }
        }
        UpdatePanel _centerRightUpdatePanel;
        /// <summary>
        /// 获取中间右边容器更新对象。
        /// </summary>
        /// <remarks>获取中间右边容器更新对象。</remarks>
        /// <value>System.Web.UI.UpdatePanel</value>
        [Browsable(false)]
        public UpdatePanel CenterRightUpdatePanel
        {
            get
            {
                return _centerRightUpdatePanel;
            }
        }
        /// <summary>
        /// 获取或设置中间左边宽度。
        /// </summary>
        /// <remarks>获取或设置中间左边宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "150px")]
        [SRCategory("CenterLeft")]
        [DisplayName("CenterLeftWidth")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterLeftWidth", typeof(Properties.Resources))]
        public Unit CenterLeftWidth
        {
            get
            {
                object o = this.ViewState["CenterLeftWidth"];
                if (o == null) return Unit.Pixel(150);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterLeftWidth"] = value;
            }
        }
        #endregion
        #endregion
        #region BackgroundCenterEndControl
        private Table _centerEndTable;
        TableRow _centerEndRow;
        private TableCell _centerEndRightCell;
        private TableCell _centerEndLeftCell;
        private TableCell _centerEndCenterCell;
        /// <summary>
        /// 获取中间底部表对象。
        /// </summary>
        /// <remarks>获取中间底部表对象。</remarks>
        /// <value>System.Web.UI.WebControls.CenterEndTable</value>
        [Browsable(false)]
        public System.Web.UI.WebControls.Table CenterEndTable
        {
            get
            {
                return _centerEndTable;
            }
        }

        /// <summary>
        /// 获取中间底部行对象。
        /// </summary>
        /// <remarks>获取中间底部行对象。</remarks>
        /// <value>System.Web.UI.WebControls.TableRow</value>
        [Browsable(false)]
        public TableRow CenterEndRow
        {
            get
            {
                return _centerEndRow;
            }
        }

        /// <summary>
        /// 获取或设置中间底部右边例宽度。
        /// </summary>
        /// <remarks>获取或设置中间底部右边例宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "10px")]
        [SRCategory("BackgroundCenterEndControl")]
        [DisplayName("RightCellWidth")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterEndRightCellWidth", typeof(Properties.Resources))]
        public Unit CenterEndRightCellWidth
        {
            get
            {
                object o = this.ViewState["CenterEndRightCellWidth"];
                if (o == null) return Unit.Pixel(10);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterEndRightCellWidth"] = value;
            }
        }

        /// <summary>
        /// 获取或设置中间底部右边例背景图片。
        /// </summary>
        /// <remarks>获取或设置中间底部右边例背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundCenterEndControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [DisplayName("RightCellBackImage")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterEndRightCellBackImage", typeof(Properties.Resources))]
        public string CenterEndRightCellBackImage
        {
            get
            {
                object o = this.ViewState["CenterEndRightCellBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterEndRightCellBackImage"] = value;
            }
        }

        /// <summary>
        /// 获取中间底部右边例对象。
        /// </summary>
        /// <remarks>获取中间底部右边例对象。</remarks>
        /// <value>TableCell</value>
        [Browsable(false)]
        public TableCell CenterEndRightCell
        {
            get
            {
                return _centerEndRightCell;
            }
        }

        /// <summary>
        /// 获取或设置中间底部左边例宽度。
        /// </summary>
        /// <remarks>获取或设置中间底部左边例宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "160px")]
        [SRCategory("BackgroundCenterEndControl")]
        [DisplayName("LeftCellWidth")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterEndLeftCellWidth", typeof(Properties.Resources))]
        public Unit CenterEndLeftCellWidth
        {
            get
            {
                object o = this.ViewState["CenterEndLeftCellWidth"];
                if (o == null) return Unit.Pixel(160);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterEndLeftCellWidth"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间底部高度。
        /// </summary>
        /// <remarks>获取或设置中间底部高度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "10px")]
        [SRCategory("BackgroundCenterEndControl")]
        [DisplayName("CenterEndHeight")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterEndHeight", typeof(Properties.Resources))]
        public Unit CenterEndHeight
        {
            get
            {
                object o = this.ViewState["CenterEndHeight"];
                if (o == null) return Unit.Pixel(10);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterEndHeight"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间底部左边例背景图片。
        /// </summary>
        /// <remarks>获取或设置中间底部左边例背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundCenterEndControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [DisplayName("LeftCellBackImage")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterEndLeftCellBackImage", typeof(Properties.Resources))]
        public string CenterEndLeftCellBackImage
        {
            get
            {
                object o = this.ViewState["CenterEndLeftCellBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterEndLeftCellBackImage"] = value;
            }
        }
        UpdatePanel _centerEndUpdatePanel;
        /// <summary>
        /// 获取中间底部更新对象。
        /// </summary>
        /// <remarks>获取中间底部更新对象。</remarks>
        /// <value>System.Web.UI.UpdatePanel</value>
        [Browsable(false)]
        public UpdatePanel CenterEndUpdatePanel
        {
            get
            {
                return _centerEndUpdatePanel;
            }
        }
        /// <summary>
        /// 获取中间底部左边例对象。
        /// </summary>
        /// <remarks>获取中间底部左边例对象。</remarks>
        /// <value>TableCell</value>
        [Browsable(false)]
        public TableCell CenterEndLeftCell
        {
            get
            {
                return _centerEndLeftCell;
            }
        }

        /// <summary>
        /// 获取或设置中间底部中间例宽度。
        /// </summary>
        /// <remarks>获取或设置中间底部中间例宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "")]
        [SRCategory("BackgroundCenterEndControl")]
        [DisplayName("CenterCellWidth")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterEndCenterCellWidth", typeof(Properties.Resources))]
        public Unit CenterEndCenterCellWidth
        {
            get
            {
                object o = this.ViewState["CenterEndCenterCellWidth"];
                if (o == null) return Unit.Empty;
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterEndCenterCellWidth"] = value;
            }
        }

        /// <summary>
        /// 获取或设置中间底部中间例背景图片。
        /// </summary>
        /// <remarks>获取或设置中间底部中间例背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundCenterEndControl")]
        [DisplayName("CenterCellBackImage")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterEndCenterCellBackImage", typeof(Properties.Resources))]
        public string CenterEndCenterCellBackImage
        {
            get
            {
                object o = this.ViewState["CenterEndCenterCellBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterEndCenterCellBackImage"] = value;
            }
        }

        /// <summary>
        /// 获取中间底部中间例对象。
        /// </summary>
        /// <remarks>获取中间底部中间例对象。</remarks>
        /// <value>TableCell</value>
        [Browsable(false)]
        public TableCell CenterEndCenterCell
        {
            get
            {
                return _centerEndCenterCell;
            }
        }
        #endregion
        #endregion
        /// <summary>
        /// 更新左边菜单 UpdatePanel 对象。
        /// </summary>
        /// <remarks>更新左边菜单 UpdatePanel 对象。</remarks>
        public virtual void LeftUpdate()
        {
            if (this._centerLeftUpdatePanel != null)
                this._centerLeftUpdatePanel.Update();
        }
        /// <summary>
        /// 更新内部所有 UpdatePanel 对象。
        /// </summary>
        /// <remarks>更新内部所有 UpdatePanel 对象。</remarks>
        public virtual void AllUpdate()
        {
            //
            if (this._headUpdatePanel != null)
                this._headUpdatePanel.Update();
            //
            if (this._centerHeadUpdatePanel != null)
                this._centerHeadUpdatePanel.Update();
            //
            if (this._centerUpdatePanel != null)
                this._centerUpdatePanel.Update();
            //
            if (this._centerHeadLeftCellUpdatePanel != null && this._centerHeadLeftCellUpdatePanel.UpdateMode == UpdatePanelUpdateMode.Conditional)
            {
                this._centerHeadLeftCellUpdatePanel.Update();
            }
            if (this._centerHeadCenterCellUpdatePanel != null && this._centerHeadCenterCellUpdatePanel.UpdateMode == UpdatePanelUpdateMode.Conditional)
            {
                this._centerHeadCenterCellUpdatePanel.Update();
            }
            //
            if (this._centerRightUpdatePanel != null)
                this._centerRightUpdatePanel.Update();
            //
            if (this._centerLeftUpdatePanel != null)
                this._centerLeftUpdatePanel.Update();
            //
            if (this._centerEndUpdatePanel != null)
                this._centerEndUpdatePanel.Update();
            //
            if (this._copyrightUpdatePanel != null)
                this._copyrightUpdatePanel.Update();
        }
        private static readonly object _actionObject = new object();
        private static readonly object _commandObject = new object();
        private Panel _centerLeftMenuEnd;
        private BackgroundCenterLeftMenuTitleControlCollection _centerLeftMenuTitles = null;
        /// <summary>
        /// 获取或设置中间左边菜单按钮背景图片。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单按钮背景图片。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [DisplayName("ButtonBackImage")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterLeftMenuButtonBackImage", typeof(Properties.Resources))]
        public string CenterLeftMenuButtonBackImage
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuButtonBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterLeftMenuButtonBackImage"] = value;
            }
        }

        /// <summary>
        /// 获取或设置中间左边菜单按钮高度。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单按钮高度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "26px")]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("ButtonHeight")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterLeftMenuButtonHeight", typeof(Properties.Resources))]
        public virtual Unit CenterLeftMenuButtonHeight
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuButtonHeight"];
                if (o == null)
                {
                    return Unit.Pixel(26);
                }
                else
                {
                    return (Unit)o;
                }
            }
            set
            {
                this.ViewState["CenterLeftMenuButtonHeight"] = value;
            }
        }
        /// <summary>
        /// 获取中间左边菜单底部高度。
        /// </summary>
        /// <remarks>获取中间左边菜单底部高度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "6px")]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("EndHeight")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("EndHeight", typeof(Properties.Resources))]
        public Unit CenterLeftMenuEndHeight
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuEndHeight"];
                if (o == null)
                    return Unit.Pixel(6);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterLeftMenuEndHeight"] = value;
            }
        }
        /// <summary>
        /// 获取中间左边菜单底部背景图片。
        /// </summary>
        /// <remarks>获取中间左边菜单底部背景图片。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("EndBackImage")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterLeftMenuEndBackImage", typeof(Properties.Resources))]
        public string CenterLeftMenuEndBackImage
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuEndBackImage"];
                if (o == null)
                    return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterLeftMenuEndBackImage"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间左边菜单标题折叠图标。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单标题折叠图标。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("CollapseIcon")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("CollapseIcon", typeof(Properties.Resources))]
        public string CenterLeftMenuCollapseIcon
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuCollapseIcon"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterLeftMenuCollapseIcon"] = value;
            }
        }
        CenterLeftMenuControl _centerLeftMenu;
        /// <summary>
        /// 获取中间左边菜单对象。
        /// </summary>
        /// <remarks>获取中间左边菜单对象。</remarks>
        /// <value>GSC.WebControls.BackgroundControl.CenterLeftMenuControl</value>
        [Browsable(false)]
        public CenterLeftMenuControl BackgroundCenterLeftMenuControl
        {
            get
            {
                return _centerLeftMenu;
            }
        }
        /// <summary>
        /// 获取中间左边菜单底部对象。
        /// </summary>
        /// <remarks>获取中间左边菜单底部对象。</remarks>
        /// <value>System.Web.UI.WebControls.Panel</value>
        [Browsable(false)]
        public Panel CenterLeftMenuEnd
        {
            get
            {
                return _centerLeftMenuEnd;
            }
        }
        /// <summary>
        /// 获取或设置中间左边菜单标题展开图标。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单标题展开图标。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("ExpandedIcon")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("ExpandedIcon", typeof(Properties.Resources))]
        public string CenterLeftMenuExpandedIcon
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuExpandedIcon"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterLeftMenuExpandedIcon"] = value;
            }
        }

        /// <summary>
        /// 获取中间左边菜单是否可以多展开标题。
        /// </summary>
        /// <remarks>获取中间左边菜单是否可以多展开标题。</remarks>
        /// <value>bool</value>
        [DefaultValue(false)]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("MultiLine")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterLeftMenuMultiLine", typeof(Properties.Resources))]
        public bool CenterLeftMenuMultiLine
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuMultiLine"];
                if (o == null) return false;
                return (bool)o;
            }
            set
            {
                if (!value)
                {
                    bool ise = true;
                    foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
                    {
                        if (ise && item.IsExpanded)
                        {
                            ise = false;
                        }
                        else
                        {
                            item.IsExpanded = false;
                        }
                    }
                }
                this.ViewState["CenterLeftMenuMultiLine"] = value;
            }
        }

        /// <summary>
        /// 获取或设置中间左边菜单按钮选中背景图片。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单按钮选中背景图片。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("SelectedButtonBackImage")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterLeftMenuSelectedButtonBackImage", typeof(Properties.Resources))]
        public string CenterLeftMenuSelectedButtonBackImage
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuSelectedButtonBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterLeftMenuSelectedButtonBackImage"] = value;
            }
        }

        /// <summary>
        /// 获取或设置中间左边菜单是否显示底部对象。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单是否显示底部对象。</remarks>
        /// <value>bool</value>
        [DefaultValue(true)]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("ShowEnd")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("ShowEnd", typeof(Properties.Resources))]
        public bool CenterLeftMenuShowEnd
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuShowEnd"];
                if (o == null) return true;
                return (bool)o;
            }
            set
            {
                this.ViewState["CenterLeftMenuShowEnd"] = value;
            }
        }

        /// <summary>
        /// 获取或设置中间左边菜单标题背景图片。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单标题背景图片。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("TitleBackImage")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterLeftMenuTitleBackImage", typeof(Properties.Resources))]
        public string CenterLeftMenuTitleBackImage
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuTitleBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterLeftMenuTitleBackImage"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间左边菜单标题文字上边距离。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单标题文字上边距离。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "5px")]
        [Browsable(true)]
        [Bindable(true)]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [SRDescription("Manage_Master_CenterLeftMenuTitleTextMarginTop", typeof(Properties.Resources))]
        [DisplayName("TitleTextMarginTop")]
        public Unit CenterLeftMenuTitleTextMarginTop
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuTitleTextMarginTop"];
                if (o == null) return Unit.Pixel(5);
                return (Unit)o;
            }
            set
            {
                if (value.IsEmpty) value = Unit.Pixel(5);
                this.ViewState["CenterLeftMenuTitleTextMarginTop"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间左边菜单标题文字宽度，在文字有溢出时设置。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单标题文字宽度，在文字有溢出时设置。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "")]
        [Browsable(true)]
        [Bindable(true)]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [SRDescription("Manage_Master_CenterLeftMenuTitleTextWidth", typeof(Properties.Resources))]
        [DisplayName("TitleTextWidth")]
        public Unit CenterLeftMenuTitleTextWidth
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuTitleTextWidth"];
                if (o == null) return Unit.Empty;
                return (Unit)o;
            }
            set
            {
                this.ViewState["CenterLeftMenuTitleTextWidth"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间左边菜单标题高度。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单标题高度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DefaultValue(typeof(Unit), "29px")]
        [DisplayName("TitleHeight")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterLeftMenuTitleHeight", typeof(Properties.Resources))]
        public virtual Unit CenterLeftMenuTitleHeight
        {
            get
            {
                object o = this.ViewState["CenterLeftMenuTitleHeight"];
                if (o == null)
                {
                    return Unit.Pixel(29);
                }
                else
                {
                    return (Unit)o;
                }
            }
            set
            {
                this.ViewState["CenterLeftMenuTitleHeight"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间左边菜单标题集合。
        /// </summary>
        /// <remarks>获取或设置中间左边菜单标题集合。</remarks>
        /// <value>GSC.WebControls.LeftMenuTitleCollection</value>
        [
               PersistenceMode(PersistenceMode.InnerProperty),
               DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
               EditorAttribute(typeof(BackgroundCenterLeftMenuTitleControlCollectionEditor), typeof(UITypeEditor)),
               NotifyParentProperty(true)
               ]
        [SRCategory("BackgroundCenterLeftMenuControl")]
        [DisplayName("Titles")]
        [SRDescription("Manage_Master_CenterLeftMenuTitles", typeof(Properties.Resources))]
        public BackgroundCenterLeftMenuTitleControlCollection CenterLeftMenuTitles
        {
            get
            {
                if (_centerLeftMenuTitles == null)
                {
                    _centerLeftMenuTitles = new BackgroundCenterLeftMenuTitleControlCollection();
                    if (IsTrackingViewState)
                    {
                        ((IStateManager)_centerLeftMenuTitles).TrackViewState();
                    }
                }
                return _centerLeftMenuTitles;
            }
        }

        /// <summary>
        /// 中间左边菜单标题动作按钮事件。
        /// </summary>
        /// <remarks>中间左边菜单标题动作按钮事件。</remarks>
        /// <param name="e"></param>
        protected virtual void OnMenuCommand(BackgroundCenterLeftMenuControlCommandEventArgs e)
        {
            CenterLeftMenuCommandEventHandler handler = (CenterLeftMenuCommandEventHandler)Events[_commandObject];
            if (handler != null)
            {
                handler(this, e);
            }
        }
        /// <summary>
        /// 中间左边菜单标题动作事件。
        /// </summary>
        /// <remarks>中间左边菜单标题动作事件。</remarks>
        /// <param name="e"></param>
        protected virtual void OnMenuAction(BackgroundCenterLeftMenuControlActionEventArgs e)
        {
            CenterLeftMenuActionEventHandler handler = (CenterLeftMenuActionEventHandler)Events[_actionObject];
            if (handler != null)
            {
                handler(this, e);
            }
        }
        /// <summary>
        /// 获取或设置中间右边背景图片。
        /// </summary>
        /// <remarks>获取或设置中间右边背景图片。</remarks>
        /// <value>string</value>
        [SRCategory("BackgroundCenterRightControl")]
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CenterRightBackImage", typeof(Properties.Resources))]
        public string CenterRightBackImage
        {
            get
            {
                object o = this.ViewState["CenterRightBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CenterRightBackImage"] = value;
            }
        }
        Panel _centerRightContainer;
        /// <summary>
        /// 获取中间右边容器对象。
        /// </summary>
        /// <remarks>获取中间右边容器对象。</remarks>
        /// <value>System.Web.UI.WebControls.Panel</value>
        [Browsable(false)]
        public Panel CenterRightContainer
        {
            get
            {
                return _centerRightContainer;
            }
        }
        PlaceHolder _centerRightPlaceHolder;
        /// <summary>
        /// 获取中间右边容器加载对象。
        /// </summary>
        /// <remarks>获取中间右边容器加载对象。</remarks>
        /// <value>System.Web.UI.WebControls.PlaceHolder</value>
        [Browsable(false)]
        public PlaceHolder CenterRightPlaceHolder
        {
            get
            {
                if (_centerRightPlaceHolder == null) _centerRightPlaceHolder = new PlaceHolder();
                return _centerRightPlaceHolder;
            }
        }
        /// <summary>
        /// 中间左边菜单标题动作按钮事件。
        /// </summary>
        /// <remarks>中间左边菜单标题动作按钮事件。</remarks>
        [Browsable(true)]
        [Category("Behavior")]
        [SRDescription("Manage_Master_MenuCommand", typeof(Properties.Resources))]
        public event CenterLeftMenuCommandEventHandler MenuCommand
        {
            add
            {
                Events.AddHandler(_commandObject, value);
            }
            remove
            {
                Events.RemoveHandler(_commandObject, value);
            }
        }
        /// <summary>
        /// 中间左边菜单标题动作事件。
        /// </summary>
        /// <remarks>中间左边菜单标题动作事件。</remarks>
        [Browsable(true)]
        [Category("Behavior")]
        [SRDescription("Manage_Master_MenuAction", typeof(Properties.Resources))]
        public event CenterLeftMenuActionEventHandler MenuAction
        {
            add
            {
                Events.AddHandler(_actionObject, value);
            }
            remove
            {
                Events.RemoveHandler(_actionObject, value);
            }
        }

        /// <summary>
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            Page.RegisterRequiresControlState(this);
            base.OnInit(e);
            if (!this.DesignMode)
            {
                this.UpdateAscx();
                this.UpdateMenuAscx();
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
        }
        /// <summary>
        /// 客户端pos事件处理。
        /// </summary>
        /// <remarks>客户端pos事件处理。</remarks>
        /// <param name="eventArgument"></param>
        protected virtual void RaisePostBackEvent(string eventArgument)
        {
            //转换客户端递交事件内容
            string[] Argument = eventArgument.Split(new Char[] { '&' });
            int n = 0;
            int cn = Convert.ToInt32(Argument[1]);
            //事件分类执行
            switch (Argument[0])
            {
                case "Title":
                    BackgroundCenterLeftMenuTitleControl title = null;
                    bool isExpanded = false;
                    //展开操作。
                    if (this.CenterLeftMenuMultiLine)
                    {
                        foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
                        {
                            if (cn == n)
                            {
                                isExpanded = item.IsExpanded;
                                title = item;
                                if (item.IsExpanded)
                                    item.IsExpanded = false;
                                else
                                    item.IsExpanded = true;
                                ((IStateManager)item).TrackViewState();
                                break;
                            }
                            n++;
                        }
                    }
                    else
                    {
                        foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
                        {
                            if (cn == n)
                            {
                                isExpanded = item.IsExpanded;
                                title = item;
                                if (item.IsExpanded)
                                    item.IsExpanded = false;
                                else
                                    item.IsExpanded = true;
                            }
                            else
                            {
                                if (item.IsExpanded)
                                {
                                    item.IsExpanded = false;
                                }
                            }
                            n++;
                        }
                    }
                    this.OnMenuAction(new BackgroundCenterLeftMenuControlActionEventArgs(title, isExpanded ? false : true, isExpanded ? true : false, title.CommandName, title.CommandArgument));
                    break;
                case "Button":
                    BackgroundCenterLeftMenuButtonControl button = null;
                    foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
                    {
                        foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                        {
                            if (cn == n)
                            {
                                button = citem;
                                if (!button.IsSelected)
                                {
                                    button.IsSelected = true;
                                }
                                //加载控件。
                                if (this.AutomaticLoadControl && citem.Ascx != string.Empty && citem.Ascx.EndsWith(".ascx", StringComparison.InvariantCultureIgnoreCase))
                                {
                                    this.UpdateAscx(citem.Ascx);
                                }
                            }
                            else
                            {
                                if (citem.IsSelected)
                                {
                                    citem.IsSelected = false;
                                }
                            }
                            n++;
                        }
                    }
                    this.OnMenuCommand(new BackgroundCenterLeftMenuControlCommandEventArgs(button, button.CommandName, button.CommandArgument));
                    break;
            }
        }
        /// <summary>
        /// 获取宽度。
        /// </summary>
        /// <remarks>获取宽度。</remarks>
        [Browsable(false)]
        public new Unit Width
        {
            get
            {
                return Unit.Percentage(100);
            }
        }
        /// <summary>
        /// 获取高度。
        /// </summary>
        /// <remarks>获取高度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [Browsable(false)]
        public new Unit Height
        {
            get
            {
                return Unit.Empty;
            }
        }
        /// <summary>
        /// 获取或设置是否自动加载菜单对应的控件。
        /// </summary>
        /// <remarks>获取或设置是否自动加载菜单对应的控件。</remarks>
        /// <value>bool</value>
        [DefaultValue(false)]
        [Bindable(true)]
        [Browsable(true)]
        [Category("Behavior")]
        [SRDescription("Manage_Master_AutomaticLoadControl", typeof(Properties.Resources))]
        public bool AutomaticLoadControl
        {
            get
            {
                object o = this.ViewState["AutomaticLoadControl"];
                if (o == null) return false;
                return (bool)o;
            }
            set
            {
                this.ViewState["AutomaticLoadControl"] = value;
            }
        }
        #region CurrentMemu
        /// <summary>
        /// 获取或设置默认加载菜单控件。
        /// </summary>
        /// <remarks>获取或设置默认加载菜单控件。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Editor(typeof(UrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [Category("Behavior")]
        [SRDescription("Manage_Master_DefaultMenuAscx", typeof(Properties.Resources))]
        public string DefaultMenuAscx
        {
            get
            {
                object o = this.ViewState["DefaultMenuAscx"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["DefaultMenuAscx"] = value;
            }
        }
        /// <summary>
        /// 获取当前加载的用户菜单控件对象。
        /// </summary>
        /// <remarks>获取当前加载的用户菜单控件对象。</remarks>
        /// <value>System.Web.UI.Control</value>
        [Browsable(false)]
        public Control CurrentMenuAscx
        {
            get
            {
                return _currentMenuAscx;
            }
        }
        Control _currentMenuAscx;
        /// <summary>
        /// 加载默认菜单控件。
        /// </summary>
        /// <remarks>加载默认菜单控件。</remarks>
        public void DefaultUpdateMenuAscx()
        {
            this.ClearLoadChildMenu();
            this.UpdateMenuAscx(this.DefaultMenuAscx);
        }
        /// <summary>
        /// 加载控件，如果缓存控件存在侧自动加载缓存控件对象。
        /// </summary>
        /// <remarks>加载控件，如果缓存控件存在侧自动加载缓存控件对象。</remarks>
        public void UpdateMenuAscx()
        {
            string cacheMenuName_ = this.CacheMenuName;
            string defaultMenuAscx_ = string.Empty;//this.DefaultMenuAscx;
            //获取数据菜单对象。
            switch (this.CacheMode)
            {
                case CacheConversationMode.Application:
                    if (this.Page.Application[cacheMenuName_] != null)
                    {
                        defaultMenuAscx_ = this.Page.Application[cacheMenuName_].ToString();
                    }
                    break;
                case CacheConversationMode.Cache:
                    if (this.Page.Cache[cacheMenuName_] != null)
                    {
                        defaultMenuAscx_ = this.Page.Cache[cacheMenuName_].ToString();
                    }
                    break;
                case CacheConversationMode.Cookie:
                    HttpCookie ascxCookie = this.Page.Request.Cookies[cacheMenuName_];
                    if (ascxCookie != null)
                    {
                        defaultMenuAscx_ = ascxCookie.Value;
                    }
                    break;
                case CacheConversationMode.Session:
                    if (this.Page.Session[cacheMenuName_] != null)
                    {
                        defaultMenuAscx_ = this.Page.Session[cacheMenuName_].ToString();
                    }
                    break;
                    /*
                case CacheConversationMode.ViewState:
                    if (this.ViewState[cacheMenuName_] != null && this.ViewState[cacheMenuName_] != string.Empty)
                    {
                        defaultMenuAscx_ = this.ViewState[cacheMenuName_].ToString();
                    }
                    break;
                     */
            }
            if (defaultMenuAscx_ == string.Empty)
            {
                UpdateMenuAscx(this.DefaultMenuAscx);
            }
            else
            {
                //获取
                string[] ss = defaultMenuAscx_.Split(new char[] { '|' });
                int l = ss.Length - 1;
                //设置子菜单深度。
                this.ViewState["CurrentMenuLevel"] = l;
                //返回上一级菜单。
                UpdateMenuAscx(ss[l]);
            }
        }
        /// <summary>
        /// 加载父菜单。
        /// </summary>
        /// <remarks>加载父菜单。</remarks>
        public void LoadParentMenu()
        {
            string ascx = string.Empty;
            string cacheMenuName_ = this.CacheMenuName;
            string defaultMenuAscx_ = string.Empty;//this.DefaultMenuAscx;
            //获取数据菜单对象。
            switch (this.CacheMode)
            {
                case CacheConversationMode.Application:
                    if (this.Page.Application[cacheMenuName_] != null)
                    {
                        defaultMenuAscx_ = this.Page.Application[cacheMenuName_].ToString();
                    }
                    break;
                case CacheConversationMode.Cache:
                    if (this.Page.Cache[cacheMenuName_] != null)
                    {
                        defaultMenuAscx_ = this.Page.Cache[cacheMenuName_].ToString();
                    }
                    break;
                case CacheConversationMode.Cookie:
                    HttpCookie ascxCookie = this.Page.Request.Cookies[cacheMenuName_];
                    if (ascxCookie != null)
                    {
                        defaultMenuAscx_ = ascxCookie.Value;
                    }
                    break;
                case CacheConversationMode.Session:
                    if (this.Page.Session[cacheMenuName_] != null)
                    {
                        defaultMenuAscx_ = this.Page.Session[cacheMenuName_].ToString();
                    }
                    break;
                    /*
                case CacheConversationMode.ViewState:
                    if (this.ViewState[cacheMenuName_] != null && this.ViewState[cacheMenuName_] != string.Empty)
                    {
                        defaultMenuAscx_ = this.ViewState[cacheMenuName_].ToString();
                    }
                    break;
                     */
            }
            //验证是否存在自菜单。
            if (defaultMenuAscx_ == string.Empty)
            {
                defaultMenuAscx_ = this.DefaultMenuAscx;
                //设置子菜单深度。
                this.ViewState["CurrentMenuLevel"] = 0;
                //显示默认菜单。
                UpdateMenuAscx(this.DefaultMenuAscx);
            }
            else
            {
                //获取
                string[] ss = defaultMenuAscx_.Split(new char[] { '|' });
                defaultMenuAscx_ = string.Empty;
                if (ss.Length == 0 || ss.Length == 1)
                {
                    defaultMenuAscx_ = this.DefaultMenuAscx;
                    //设置子菜单深度。
                    this.ViewState["CurrentMenuLevel"] = 0;
                    //显示默认菜单。
                    ascx = defaultMenuAscx_;
                }
                else
                {
                    int l = ss.Length - 1;
                    //删除最后一组菜单。
                    for (int i = 0; i < l; i++)
                    {
                        if (defaultMenuAscx_ == string.Empty)
                            defaultMenuAscx_ = ss[i];
                        else
                            defaultMenuAscx_ += "|" + ss[i];
                    }
                    //设置子菜单深度。
                    this.ViewState["CurrentMenuLevel"] = l - 1;
                    ascx = ss[l - 1];
                }
            }
            //设置菜单。
            switch (this.CacheMode)
            {
                case CacheConversationMode.Application:
                    this.Page.Application[cacheMenuName_] = defaultMenuAscx_;
                    break;
                case CacheConversationMode.Cache:
                    this.Page.Cache[cacheMenuName_] = defaultMenuAscx_;
                    break;
                case CacheConversationMode.Cookie:
                    HttpCookie ascxCookie = this.Page.Request.Cookies[cacheMenuName_];
                    if (ascxCookie == null)
                    {
                        ascxCookie = new HttpCookie(cacheMenuName_);
                        ascxCookie.Expires = DateTime.MaxValue;
                        ascxCookie.Value = defaultMenuAscx_;
                        this.Page.Response.Cookies.Add(ascxCookie);
                    }
                    else
                    {
                        ascxCookie.Value = defaultMenuAscx_;
                        this.Page.Response.Cookies.Set(ascxCookie);
                    }
                    break;
                case CacheConversationMode.Session:
                    this.Page.Session[cacheMenuName_] = defaultMenuAscx_;
                    break;
                    /*
                case CacheConversationMode.ViewState:
                    this.ViewState[cacheMenuName_] = defaultMenuAscx_;
                    break;
                     */
            }
            //返回上一级菜单。
            UpdateMenuAscx(ascx);
        }
        /// <summary>
        /// 加载子菜单。
        /// </summary>
        /// <remarks>加载子菜单。</remarks>
        /// <param name="ascx"></param>
        public void LoadChildMenu(string ascx)
        {
            if (string.IsNullOrEmpty(ascx)) throw new ArgumentNullException();
            //
            string cacheMenuName_ = this.CacheMenuName;
            string defaultMenuAscx_ = string.Empty;//this.DefaultMenuAscx;
            //获取数据菜单对象。
            switch (this.CacheMode)
            {
                case CacheConversationMode.Application:
                    if (this.Page.Application[cacheMenuName_] != null)
                    {
                        defaultMenuAscx_ = this.Page.Application[cacheMenuName_].ToString();
                    }
                    break;
                case CacheConversationMode.Cache:
                    if (this.Page.Cache[cacheMenuName_] != null)
                    {
                        defaultMenuAscx_ = this.Page.Cache[cacheMenuName_].ToString();
                    }
                    break;
                case CacheConversationMode.Cookie:
                    HttpCookie ascxCookie = this.Page.Request.Cookies[cacheMenuName_];
                    if (ascxCookie != null)
                    {
                        defaultMenuAscx_ = ascxCookie.Value;
                    }
                    break;
                case CacheConversationMode.Session:
                    if (this.Page.Session[cacheMenuName_] != null)
                    {
                        defaultMenuAscx_ = this.Page.Session[cacheMenuName_].ToString();
                    }
                    break;
                    /*
                case CacheConversationMode.ViewState:
                    if (this.ViewState[cacheMenuName_] != null && this.ViewState[cacheMenuName_] != string.Empty)
                    {
                        defaultMenuAscx_ = this.ViewState[cacheMenuName_].ToString();
                    }
                    break;
                     */
            }
            //
            if (defaultMenuAscx_ == string.Empty)
            {
                defaultMenuAscx_ = this.DefaultMenuAscx + "|" + ascx;
            }
            else
            {
                //验证尾部是否为相同菜单。
                //if (!defaultMenuAscx_.EndsWith(ascx, StringComparison.InvariantCultureIgnoreCase))
                //{
                defaultMenuAscx_ = defaultMenuAscx_ + "|" + ascx;
                //}
            }
            //设置子菜单深度。
            this.ViewState["CurrentMenuLevel"] = defaultMenuAscx_.Split(new char[] { '|' }).Length - 1;
            //设置菜单。
            switch (this.CacheMode)
            {
                case CacheConversationMode.Application:
                    this.Page.Application[cacheMenuName_] = defaultMenuAscx_;
                    break;
                case CacheConversationMode.Cache:
                    this.Page.Cache[cacheMenuName_] = defaultMenuAscx_;
                    break;
                case CacheConversationMode.Cookie:
                    HttpCookie ascxCookie = this.Page.Request.Cookies[cacheMenuName_];
                    if (ascxCookie == null)
                    {
                        ascxCookie = new HttpCookie(cacheMenuName_);
                        ascxCookie.Expires = DateTime.MaxValue;
                        ascxCookie.Value = defaultMenuAscx_;
                        this.Page.Response.Cookies.Add(ascxCookie);
                    }
                    else
                    {
                        ascxCookie.Value = defaultMenuAscx_;
                        this.Page.Response.Cookies.Set(ascxCookie);
                    }
                    break;
                case CacheConversationMode.Session:
                    this.Page.Session[cacheMenuName_] = defaultMenuAscx_;
                    break;
                    /*
                case CacheConversationMode.ViewState:
                    this.ViewState[cacheMenuName_] = defaultMenuAscx_;
                    break;
                     */
            }
            //
            this.UpdateMenuAscx(ascx);
        }
        /// <summary>
        /// 清除全部子菜单。
        /// </summary>
        public void ClearLoadChildMenu()
        {
            string cacheMenuName_ = this.CacheMenuName;
            this.ViewState["CurrentMenuLevel"] = null;
            switch (this.CacheMode)
            {
                case CacheConversationMode.Application:
                    this.Page.Application[cacheMenuName_] = string.Empty;
                    break;
                case CacheConversationMode.Cache:
                    this.Page.Cache[cacheMenuName_] = string.Empty;
                    break;
                case CacheConversationMode.Cookie:
                    HttpCookie ascxCookie = this.Page.Request.Cookies[cacheMenuName_];
                    if (ascxCookie != null)
                    {
                        this.Page.Response.Cookies.Remove(cacheMenuName_);
                    }
                    break;
                case CacheConversationMode.Session:
                    this.Page.Session[cacheMenuName_] = string.Empty;
                    break;
                    /*
                case CacheConversationMode.ViewState:
                    this.ViewState[cacheMenuName_] = string.Empty;
                    break;
                     */
            }
        }
        /// <summary>
        /// 加载指定控件。
        /// </summary>
        /// <remarks>加载指定控件。</remarks>
        /// <param name="ascx">设置要加载的控件对象。</param>
        public void UpdateMenuAscx(string ascx)
        {
            //如果菜单控件为空侧退出加载。
            if (string.IsNullOrEmpty(ascx)) return;
            //清除菜单指针控件。
            this._currentMenuAscx = null;
            //清空菜单控件容器。
            this.CenterLeftPlaceHolder.Controls.Clear();
            //加载菜单指针控件对象。
            this._currentMenuAscx = this.Page.LoadControl(ascx);
            //验证菜单控件类型是否有效。
            if (!(this._currentMenuAscx.Controls[0] is BackgroundCenterLeftMenuControl || this._currentMenuAscx.Controls[0] is BackgroundCenterLeftButtonControl)) throw new ArgumentException();
            //设置菜单控件ID。
            this._currentMenuAscx.ID = "MenuAscx";
            //装载菜单控件到菜单容器中。
            this.CenterLeftPlaceHolder.Controls.Add(this._currentMenuAscx);
            //验证加载控件是否使用左边菜单管理接口。
            if (this._currentMenuAscx is IManageMaster)
            {
                //设置菜单管理接口对象。
                ((IManageMaster)this._currentMenuAscx).BackgroundControl = this;
            }
            //设置选中ID接口ID。
            if (this._loadMenuID != string.Empty)
            {
                bool isSelected = false;
                if (this._currentMenuAscx.Controls[0] is BackgroundCenterLeftMenuControl)
                {
                    BackgroundCenterLeftMenuControl clm = (BackgroundCenterLeftMenuControl)this._currentMenuAscx.Controls[0];
                    foreach (BackgroundCenterLeftMenuTitleControl item in clm.Titles)
                    {
                        foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                        {
                            if (citem.ID.Equals(this._loadMenuID, StringComparison.InvariantCultureIgnoreCase))
                            {
                                isSelected = true;
                                citem.IsSelected = true;
                                item.IsExpanded = true;
                            }
                        }
                    }
                    if (isSelected)
                    {
                        foreach (BackgroundCenterLeftMenuTitleControl item in clm.Titles)
                        {
                            foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                            {
                                if (!citem.ID.Equals(this._loadMenuID, StringComparison.InvariantCultureIgnoreCase))
                                {
                                    item.IsExpanded = false;
                                    citem.IsSelected = false;
                                }
                            }
                        }
                    }
                }
                else if (this._currentMenuAscx.Controls[0] is BackgroundCenterLeftButtonControl)
                {

                    foreach (BackgroundCenterLeftMenuButtonControl item in ((BackgroundCenterLeftButtonControl)this._currentMenuAscx.Controls[0]).Buttons)
                    {
                        if (item.ID.Equals(this._loadMenuID, StringComparison.InvariantCultureIgnoreCase))
                        {
                            isSelected = true;
                            item.IsSelected = true;
                        }
                    }
                    if (isSelected)
                    {
                        foreach (BackgroundCenterLeftMenuButtonControl item in ((BackgroundCenterLeftButtonControl)this._currentMenuAscx.Controls[0]).Buttons)
                        {
                            if (!item.ID.Equals(this._loadMenuID, StringComparison.InvariantCultureIgnoreCase))
                            {
                                item.IsSelected = false;
                            }
                        }
                    }
                }
            }
            //右边内容更新对象如果不为空侧更新。
            if (this._centerLeftUpdatePanel != null)
                this._centerLeftUpdatePanel.Update();
        }
        #endregion
        #region UpdateAscx
        /// <summary>
        /// 获取当前加载的用户控件对象。
        /// </summary>
        /// <remarks>获取当前加载的用户控件对象。</remarks>
        /// <value>System.Web.UI.Control</value>
        [Browsable(false)]
        public Control CurrentAscx
        {
            get
            {
                return _currentAscx;
            }
        }
        Control _currentAscx;
        /// <summary>
        /// 加载默认控件。
        /// </summary>
        /// <remarks>加载默认控件。</remarks>
        public void DefaultUpdateAscx()
        {
            UpdateAscx(this.DefaultAscx);
        }
        /// <summary>
        /// 加载控件，如果缓存控件存在侧自动加载缓存控件对象。
        /// </summary>
        /// <remarks>加载控件，如果缓存控件存在侧自动加载缓存控件对象。</remarks>
        public void UpdateAscx()
        {
            UpdateAscx(string.Empty);
        }
        /// <summary>
        /// 加载指定控件。
        /// </summary>
        /// <remarks>加载指定控件。</remarks>
        /// <param name="ascx">设置要加载的控件对象。</param>
        public void UpdateAscx(string ascx)
        {
            this._currentAscx = null;
            this.CenterRightPlaceHolder.Controls.Clear();
            string cacheName_ = this.CacheName;
            switch (this.CacheMode)
            {
                case CacheConversationMode.Application:
                    if (this.Page.Application[cacheName_] == null)
                    {
                        if (string.IsNullOrEmpty(ascx))
                        {
                            if (this.DefaultAscx != string.Empty)
                            {
                                this._currentAscx = this.Page.LoadControl(this.DefaultAscx);
                                this._currentAscx.ID = "Ascx";
                                this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                                this.Page.Application[cacheName_] = this.DefaultAscx;
                            }
                        }
                        else
                        {
                            this._currentAscx = this.Page.LoadControl(ascx);
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                            this.Page.Application[cacheName_] = ascx;
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(ascx))
                        {
                            this._currentAscx = this.Page.LoadControl(this.Page.Application[cacheName_].ToString());
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                        }
                        else
                        {
                            this.Page.Application[cacheName_] = ascx;
                            this._currentAscx = this.Page.LoadControl(ascx);
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                        }
                    }
                    break;
                case CacheConversationMode.Cache:
                    if (this.Page.Cache[cacheName_] == null)
                    {
                        if (string.IsNullOrEmpty(ascx))
                        {
                            if (this.DefaultAscx != string.Empty)
                            {
                                this._currentAscx = this.Page.LoadControl(this.DefaultAscx);
                                this._currentAscx.ID = "Ascx";
                                this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                                this.Page.Cache[cacheName_] = this.DefaultAscx;
                            }
                        }
                        else
                        {
                            this._currentAscx = this.Page.LoadControl(ascx);
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                            this.Page.Cache[cacheName_] = ascx;
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(ascx))
                        {
                            this._currentAscx = this.Page.LoadControl(this.Page.Cache[cacheName_].ToString());
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                        }
                        else
                        {
                            this.Page.Cache[cacheName_] = ascx;
                            this._currentAscx = this.Page.LoadControl(ascx);
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                        }
                    }
                    break;
                case CacheConversationMode.Cookie:
                    HttpCookie ascxCookie = this.Page.Request.Cookies[cacheName_];
                    if (ascxCookie == null)
                    {
                        if (string.IsNullOrEmpty(ascx))
                        {
                            if (this.DefaultAscx != string.Empty)
                            {
                                this._currentAscx = this.Page.LoadControl(this.DefaultAscx);
                                this._currentAscx.ID = "Ascx";
                                this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                                ascxCookie = new HttpCookie("Ascx");
                                ascxCookie.Expires = DateTime.MaxValue;
                                ascxCookie.Value = this.DefaultAscx;
                                this.Page.Response.Cookies.Add(ascxCookie);
                            }
                        }
                        else
                        {
                            this._currentAscx = this.Page.LoadControl(ascx);
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                            ascxCookie = new HttpCookie("Ascx");
                            ascxCookie.Expires = DateTime.MaxValue;
                            ascxCookie.Value = ascx;
                            this.Page.Response.Cookies.Add(ascxCookie);
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(ascx))
                        {
                            this._currentAscx = this.Page.LoadControl(ascxCookie.Value);
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                        }
                        else
                        {
                            ascxCookie.Value = ascx;
                            this._currentAscx = this.Page.LoadControl(ascx);
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                        }
                        this.Page.Response.Cookies.Set(ascxCookie);
                    }
                    break;
                case CacheConversationMode.Session:
                    if (this.Page.Session[cacheName_] == null)
                    {
                        if (string.IsNullOrEmpty(ascx))
                        {
                            if (this.DefaultAscx != string.Empty)
                            {
                                this._currentAscx = this.Page.LoadControl(this.DefaultAscx);
                                this._currentAscx.ID = "Ascx";
                                this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                                this.Page.Session[cacheName_] = this.DefaultAscx;
                            }
                        }
                        else
                        {
                            this._currentAscx = this.Page.LoadControl(ascx);
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                            this.Page.Session[cacheName_] = ascx;
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(ascx))
                        {
                            this._currentAscx = this.Page.LoadControl(this.Page.Session[cacheName_].ToString());
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                        }
                        else
                        {
                            this.Page.Session[cacheName_] = ascx;
                            this._currentAscx = this.Page.LoadControl(ascx);
                            this._currentAscx.ID = "Ascx";
                            this.CenterRightPlaceHolder.Controls.Add(this._currentAscx);
                        }
                    }
                    break;
            }
            //获取加载用户控件的菜单ID。
            if (this._currentAscx is ILoadMenuControlID)
            {
                //设置加载用户控件的菜单ID。
                _loadMenuID = ((ILoadMenuControlID)this._currentAscx).MenuControlID;
            }
            //验证加载控件是否使用左边菜单管理接口。
            if (this._currentAscx is IManageMaster)
            {
                //设置菜单管理接口对象。
                ((IManageMaster)this._currentAscx).BackgroundControl = this;
            }
            //右边内容更新对象如果不为空侧更新。
            if (this._centerRightUpdatePanel != null)
                this._centerRightUpdatePanel.Update();
        }
        string _loadMenuID = string.Empty;
        /// <summary>
        /// 获取或设置默认加载控件。
        /// </summary>
        /// <remarks>获取或设置默认加载控件。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Editor(typeof(UrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [Category("Behavior")]
        [SRDescription("Manage_Master_DefaultAscx", typeof(Properties.Resources))]
        public string DefaultAscx
        {
            get
            {
                object o = this.ViewState["DefaultAscx"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["DefaultAscx"] = value;
            }
        }
        #endregion
        /// <summary>
        /// 获取或设置控件容器加载的控件缓存模式。
        /// </summary>
        /// <remarks>获取或设置控件容器加载的控件缓存模式。</remarks>
        /// <value>GuoShuCan.SDK.Web.CacheConversationMode</value>
        [DefaultValue(typeof(CacheConversationMode), "Cache")]
        [Bindable(true)]
        [Browsable(true)]
        [Category("Behavior")]
        [SRDescription("Manage_Master_CacheMode", typeof(Properties.Resources))]
        public CacheConversationMode CacheMode
        {
            get
            {
                object o = this.ViewState["CacheMode"];
                if (o == null) return CacheConversationMode.Cache;
                return (CacheConversationMode)o;
            }
            set
            {
                this.ViewState["CacheMode"] = value;
            }
        }
        /// <summary>
        /// 获取或设置背景图片。
        /// </summary>
        /// <remarks>获取或设置背景图片。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [Bindable(true)]
        [Browsable(true)]
        [Category("Appearance")]
        [SRDescription("BackImageUrl", typeof(Properties.Resources))]
        public string BackImageUrl
        {
            get
            {
                object o = this.ViewState["BackImageUrl"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["BackImageUrl"] = value;
            }
        }

        /// <summary>
        /// 获取或设置背景图片。
        /// </summary>
        /// <remarks>获取或设置背景图片。</remarks>
        /// <value>Color</value>
        [DefaultValue(typeof(Color), "#4296ce")]
        [Bindable(true)]
        [Browsable(true)]
        [Category("Appearance")]
        [SRDescription("Manage_Master_BackColor", typeof(Properties.Resources))]
        [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
        public override Color BackColor
        {
            get
            {
                return base.BackColor.IsEmpty ? ColorTranslator.FromHtml("#4296ce") : base.BackColor;
            }
            set
            {
                base.BackColor = value;
            }
        }
        #region BackgroundCopyrightControl
        /// <summary>
        /// 获取或设置版权背景图片。
        /// </summary>
        /// <remarks>获取或设置版权背景图片。</remarks>
        /// <value>string</value>
        [DefaultValue("")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [SRCategory("BackgroundCopyrightControl")]
        [DisplayName("BackImage")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CopyrightBackImage", typeof(Properties.Resources))]
        public string CopyrightBackImage
        {
            get
            {
                object o = this.ViewState["CopyrightBackImage"];
                if (o == null) return string.Empty;
                return (string)o;
            }
            set
            {
                this.ViewState["CopyrightBackImage"] = value;
            }
        }
        ITemplate _copyrightContentTemplate;
        /// <summary>
        /// 获取或设置版权内容模板对象。
        /// </summary>
        /// <remarks>获取或设置版权内容模板对象。</remarks>
        /// <value>System.Web.UI.ITemplate</value>
        [
                      Browsable(false),
                      PersistenceMode(PersistenceMode.InnerDefaultProperty),
                      DefaultValue(typeof(ITemplate), null),
                      Description(""),
                      TemplateContainer(typeof(BackgroundControl))
                      ]
        public ITemplate CopyrightContentTemplate
        {
            get
            {
                return _copyrightContentTemplate;
            }
            set
            {
                _copyrightContentTemplate = value;
            }
        }
        UpdatePanel _copyrightUpdatePanel;
        /// <summary>
        /// 获取版权更新对象。
        /// </summary>
        /// <remarks>获取版权更新对象。</remarks>
        /// <value>System.Web.UI.UpdatePanel</value>
        [Browsable(false)]
        public UpdatePanel CopyrightUpdatePanel
        {
            get
            {
                return _copyrightUpdatePanel;
            }
        }
        TableRow _copyrightRow;
        /// <summary>
        /// 获取版权行对象。
        /// </summary>
        /// <remarks>获取版权行对象。</remarks>
        /// <value>System.Web.UI.WebControls.TableRow</value>
        [Browsable(false)]
        public TableRow CopyrightRow
        {
            get
            {
                return _copyrightRow;
            }
        }
        TableCell _copyrightCell;
        /// <summary>
        /// 获取版权例对象。
        /// </summary>
        /// <remarks>获取版权例对象。</remarks>
        /// <value>System.Web.UI.WebControls.TableCell</value>
        [Browsable(false)]
        public TableCell CopyrightCell
        {
            get
            {
                return _copyrightCell;
            }
        }
        Table _copyright;
        /// <summary>
        /// 获取版权对象。
        /// </summary>
        /// <remarks>获取版权对象。</remarks>
        /// <value>System.Web.UI.WebControls.Table</value>
        [Browsable(false)]
        public Table CopyrightTable
        {
            get
            {
                return _copyright;
            }
        }
        /// <summary>
        /// 获取或设置版权高度。
        /// </summary>
        /// <remarks>获取或设置版权高度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "51px")]
        [SRCategory("BackgroundCopyrightControl")]
        [DisplayName("CopyrightHeight")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CopyrightHeight", typeof(Properties.Resources))]
        public Unit CopyrightHeight
        {
            get
            {
                object o = this.ViewState["CopyrightHeight"];
                if (o == null) return Unit.Pixel(51);
                return (Unit)o;
            }
            set
            {
                this.ViewState["CopyrightHeight"] = value;
            }
        }
        /// <summary>
        /// 获取或设置版权宽度。
        /// </summary>
        /// <remarks>获取或设置版权宽度。</remarks>
        /// <value>System.Web.UI.WebControls.Unit</value>
        [DefaultValue(typeof(Unit), "")]
        [SRCategory("BackgroundCopyrightControl")]
        [DisplayName("CopyrightWidth")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CopyrightWidth", typeof(Properties.Resources))]
        public Unit CopyrightWidth
        {
            get
            {
                object o = this.ViewState["CopyrightWidth"];
                if (o == null) return Unit.Empty;
                return (Unit)o;
            }
            set
            {
                this.ViewState["CopyrightWidth"] = value;
            }
        }
        #endregion
        /// <summary>
        /// 不折叠展开的标题重置默认状态。
        /// </summary>
        /// <remarks>不折叠展开的标题重置默认状态。</remarks>
        public void ResetDefault()
        {
            ResetDefault(false);
        }
        /// <summary>
        /// 重置默认状态。
        /// </summary>
        /// <remarks>重置默认状态。</remarks>
        /// <param name="isCollapseTitle">设置是否折叠标题。</param>
        public void ResetDefault(bool isCollapseTitle)
        {
            foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
            {
                if (isCollapseTitle && item.IsExpanded)
                {
                    item.IsExpanded = false;
                }
                foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                {
                    if (citem.IsSelected)
                    {
                        citem.IsSelected = false;
                    }
                }
            }
            this._centerLeftUpdatePanel.Update();
        }
        /// <summary>
        /// 获取或设置控件容器加载的控件缓存名称。
        /// </summary>
        /// <remarks>获取或设置控件容器加载的控件缓存名称。</remarks>
        /// <value>string</value>
        [DefaultValue("Ascx")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CacheName", typeof(Properties.Resources))]
        [Category("Behavior")]
        public string CacheName
        {
            get
            {
                object o = this.ViewState["CacheName"];
                if (o == null) return "Ascx";
                return (string)o;
            }
            set
            {
                this.ViewState["CacheName"] = value;
            }
        }
        /// <summary>
        /// 获取或设置控件容器加载的菜单控件缓存名称。
        /// </summary>
        /// <remarks>获取或设置控件容器加载的菜单控件缓存名称。</remarks>
        /// <value>string</value>
        [DefaultValue("MenuAscx")]
        [Bindable(true)]
        [Browsable(true)]
        [SRDescription("Manage_Master_CacheMenuName", typeof(Properties.Resources))]
        [Category("Behavior")]
        public string CacheMenuName
        {
            get
            {
                object o = this.ViewState["CacheMenuName"];
                if (o == null) return "MenuAscx";
                return (string)o;
            }
            set
            {
                this.ViewState["CacheMenuName"] = value;
            }
        }
        /// <summary>
        /// 在页面加载后只操作一次选择菜单操作，选中后下次退出不操作。
        /// </summary>
        bool isUpdateSelected = false;
        /// <summary>
        /// 设置选中按钮。
        /// </summary>
        /// <remarks>设置选中按钮。</remarks>
        /// <param name="index">设置要选中的按钮位置。</param>
        public void UpdateSelectedButton(int index)
        {
            //已经搜索到菜单指定退出。
            if (this.isUpdateSelected) return;
            BackgroundCenterLeftMenuButtonControl button = null;
            int n = 0;
            if (this._currentMenuAscx == null && this.CenterLeftMenuTitles.Count > 0)
            {
                foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
                {
                    foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                    {
                        if (index == n)
                        {
                            //菜单已经选中。
                            this.isUpdateSelected = true;
                            button = citem;
                            citem.IsSelected = true;
                            item.IsExpanded = true;
                        }
                        else
                        {
                            if (!this.CenterLeftMenuMultiLine)
                            {
                                item.IsExpanded = false;
                            }
                            citem.IsSelected = false;
                        }
                        n++;
                    }
                }
                this.OnMenuCommand(new BackgroundCenterLeftMenuControlCommandEventArgs(button, button.CommandName, button.CommandArgument));
            }
            else
            {
                if (this._currentMenuAscx.Controls[0] is BackgroundCenterLeftMenuControl)
                {
                    BackgroundCenterLeftMenuControl centerLeftMenu = (BackgroundCenterLeftMenuControl)this._currentMenuAscx.Controls[0];
                    foreach (BackgroundCenterLeftMenuTitleControl item in centerLeftMenu.Titles)
                    {
                        foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                        {
                            if (index == n)
                            {
                                //菜单已经选中。
                                this.isUpdateSelected = true;
                                button = citem;
                                citem.IsSelected = true;
                                item.IsExpanded = true;
                            }
                            else
                            {
                                if (!centerLeftMenu.MultiLine)
                                {
                                    item.IsExpanded = false;
                                }
                                citem.IsSelected = false;
                            }
                            n++;
                        }
                    }
                    this._centerLeftUpdatePanel.Update();
                }
                else if (this._currentMenuAscx.Controls[0] is BackgroundCenterLeftButtonControl)
                {
                    foreach (BackgroundCenterLeftMenuButtonControl item in ((BackgroundCenterLeftButtonControl)this._currentMenuAscx.Controls[0]).Buttons)
                    {
                        if (index == n)
                        {
                            //菜单已经选中。
                            this.isUpdateSelected = true;
                            item.IsSelected = true;
                        }
                        else
                        {
                            item.IsSelected = false;
                        }
                        n++;
                    }
                    this._centerLeftUpdatePanel.Update();
                }
            }
        }
        /// <summary>
        /// 设置选中按钮。
        /// </summary>
        /// <remarks>设置选中按钮。</remarks>
        /// <param name="id">设置要选中的按钮ID。</param> 
        public void UpdateSelectedButton(string id)
        {
            //已经搜索到菜单指定退出。
            if (this.isUpdateSelected) return;
            BackgroundCenterLeftMenuButtonControl button = null;
            if (this._currentMenuAscx == null && this.CenterLeftMenuTitles.Count > 0)
            {
                foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
                {
                    foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                    {
                        if (id == citem.ID)
                        {
                            //菜单已经选中。
                            this.isUpdateSelected = true;
                            button = citem;
                            citem.IsSelected = true;
                            item.IsExpanded = true;
                        }
                        else
                        {
                            if (!this.CenterLeftMenuMultiLine)
                            {
                                item.IsExpanded = false;
                            }
                            citem.IsSelected = false;
                        }
                    }
                }
                this._centerLeftUpdatePanel.Update();
                this.OnMenuCommand(new BackgroundCenterLeftMenuControlCommandEventArgs(button, button.CommandName, button.CommandArgument));
            }
            else
            {
                if (this._currentMenuAscx.Controls[0] is BackgroundCenterLeftMenuControl)
                {
                    BackgroundCenterLeftMenuControl centerLeftMenu = (BackgroundCenterLeftMenuControl)this._currentMenuAscx.Controls[0];
                    foreach (BackgroundCenterLeftMenuTitleControl item in centerLeftMenu.Titles)
                    {
                        foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                        {
                            if (id == citem.ID)
                            {
                                //菜单已经选中。
                                this.isUpdateSelected = true;
                                citem.IsSelected = true;
                                item.IsExpanded = true;
                            }
                            else
                            {
                                if (!centerLeftMenu.MultiLine)
                                {
                                    item.IsExpanded = false;
                                }
                                citem.IsSelected = false;
                            }
                        }
                    }
                    this._centerLeftUpdatePanel.Update();
                }
                else if (this._currentMenuAscx.Controls[0] is BackgroundCenterLeftButtonControl)
                {
                    foreach (BackgroundCenterLeftMenuButtonControl item in ((BackgroundCenterLeftButtonControl)this._currentMenuAscx.Controls[0]).Buttons)
                    {
                        if (id == item.ID)
                        {
                            //菜单已经选中。
                            this.isUpdateSelected = true;
                            item.IsSelected = true;
                        }
                        else
                        {
                            item.IsSelected = false;
                        }
                    }
                    this._centerLeftUpdatePanel.Update();
                }
            }
        }
        /// <summary>
        /// 设置选中按钮。
        /// </summary>
        /// <remarks>设置选中按钮。</remarks>
        /// <param name="id">设置要选中的按钮ID。</param> 
        /// <param name="isCollapseTitle">设置是否折叠标题。</param> 
        public void UpdateSelectedButton(string id, bool isCollapseTitle)
        {
            //已经搜索到菜单指定退出。
            if (this.isUpdateSelected) return;
            BackgroundCenterLeftMenuButtonControl button = null;
            if (this._currentMenuAscx == null && this.CenterLeftMenuTitles.Count > 0)
            {
                foreach (BackgroundCenterLeftMenuTitleControl item in this.CenterLeftMenuTitles)
                {
                    foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                    {
                        if (id == citem.ID)
                        {
                            //菜单已经选中。
                            this.isUpdateSelected = true;
                            button = citem;
                            citem.IsSelected = true;
                            if (isCollapseTitle)
                            {
                                item.IsExpanded = true;
                            }
                        }
                        else
                        {
                            if (!this.CenterLeftMenuMultiLine && isCollapseTitle)
                            {
                                item.IsExpanded = false;
                            }
                            citem.IsSelected = false;
                        }
                    }
                }
                this._centerLeftUpdatePanel.Update();
                this.OnMenuCommand(new BackgroundCenterLeftMenuControlCommandEventArgs(button, button.CommandName, button.CommandArgument));
            }
            else
            {
                if (this._currentMenuAscx.Controls[0] is BackgroundCenterLeftMenuControl)
                {
                    BackgroundCenterLeftMenuControl centerLeftMenu = (BackgroundCenterLeftMenuControl)this._currentMenuAscx.Controls[0];
                    foreach (BackgroundCenterLeftMenuTitleControl item in centerLeftMenu.Titles)
                    {
                        foreach (BackgroundCenterLeftMenuButtonControl citem in item.Buttons)
                        {
                            if (id == citem.ID)
                            {
                                //菜单已经选中。
                                this.isUpdateSelected = true;
                                citem.IsSelected = true;
                                if (isCollapseTitle)
                                {
                                    item.IsExpanded = true;
                                }
                            }
                            else
                            {
                                if (!centerLeftMenu.MultiLine && isCollapseTitle)
                                {
                                    item.IsExpanded = false;
                                }
                                citem.IsSelected = false;
                            }
                        }
                    }
                    this._centerLeftUpdatePanel.Update();
                }
                else if (this._currentMenuAscx.Controls[0] is BackgroundCenterLeftButtonControl)
                {
                    foreach (BackgroundCenterLeftMenuButtonControl item in ((BackgroundCenterLeftButtonControl)this._currentMenuAscx.Controls[0]).Buttons)
                    {
                        if (id == item.ID)
                        {
                            //菜单已经选中。
                            this.isUpdateSelected = true;
                            item.IsSelected = true;
                        }
                        else
                        {
                            item.IsSelected = false;
                        }
                    }
                    this._centerLeftUpdatePanel.Update();
                }
            }
        }
        /// <summary>
        /// 获取或设置中间头部中间 UpdatePanel 控件的内容是否包含在 HTML &lt;div&gt; 或 &lt;span&gt; 元素中。
        /// </summary>
        /// <remarks>获取或设置中间头部中间 UpdatePanel 控件的内容是否包含在 HTML &lt;div&gt; 或 &lt;span&gt; 元素中。</remarks>
        /// <value>System.Web.UI.UpdatePanelRenderMode</value>
        [Browsable(true)]
        [DefaultValue(typeof(UpdatePanelRenderMode), "Block")]
        [Bindable(true)]
        [SRDescription("Manage_Master_CenterHeadCenterRenderMode", typeof(Properties.Resources))]
        [SRCategory("BackgroundCenterHeadControl")]
        [DisplayName("CenterRenderMode")]
        public UpdatePanelRenderMode CenterHeadCenterRenderMode
        {
            get
            {
                object o = this.ViewState["CenterHeadCenterRenderMode"];
                if (o == null) return UpdatePanelRenderMode.Block;
                return (UpdatePanelRenderMode)o;
            }
            set
            {
                this.ViewState["CenterHeadCenterRenderMode"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间头部何时更新中间 UpdatePanel 控件的内容。
        /// </summary>
        /// <remarks>获取或设置中间头部何时更新中间 UpdatePanel 控件的内容。</remarks>
        /// <value>System.Web.UI.UpdatePanelUpdateMode</value>
        [Browsable(true)]
        [DefaultValue(typeof(UpdatePanelUpdateMode), "Always")]
        [Bindable(true)]
        [SRDescription("Manage_Master_CenterHeadCenterUpdateMode", typeof(Properties.Resources))]
        [SRCategory("BackgroundCenterHeadControl")]
        [DisplayName("CenterUpdateMode")]
        public UpdatePanelUpdateMode CenterHeadCenterUpdateMode
        {
            get
            {
                object o = this.ViewState["CenterHeadCenterUpdateMode"];
                if (o == null) return UpdatePanelUpdateMode.Always;
                return (UpdatePanelUpdateMode)o;
            }
            set
            {
                this.ViewState["CenterHeadCenterUpdateMode"] = value;
            }
        }

        /// <summary>
        /// 获取或设置中间头部何时更新左边 UpdatePanel 控件的内容。
        /// </summary>
        /// <remarks>获取或设置中间头部何时更新左边 UpdatePanel 控件的内容。</remarks>
        /// <value>System.Web.UI.UpdatePanelUpdateMode</value>
        [Browsable(true)]
        [DefaultValue(typeof(UpdatePanelUpdateMode), "Always")]
        [Bindable(true)]
        [SRDescription("Manage_Master_CenterHeadLeftUpdateMode", typeof(Properties.Resources))]
        [SRCategory("BackgroundCenterHeadControl")]
        [DisplayName("LeftUpdateMode")]
        public UpdatePanelUpdateMode CenterHeadLeftUpdateMode
        {
            get
            {
                object o = this.ViewState["CenterHeadLeftUpdateMode"];
                if (o == null) return UpdatePanelUpdateMode.Always;
                return (UpdatePanelUpdateMode)o;
            }
            set
            {
                this.ViewState["CenterHeadLeftUpdateMode"] = value;
            }
        }
        /// <summary>
        /// 获取或设置中间头部左边 UpdatePanel 控件的内容是否包含在 HTML &lt;div&gt; 或 &lt;span&gt; 元素中。
        /// </summary>
        /// <remarks>获取或设置中间头部左边 UpdatePanel 控件的内容是否包含在 HTML &lt;div&gt; 或 &lt;span&gt; 元素中。</remarks>
        /// <value>System.Web.UI.UpdatePanelRenderMode</value>
        [Browsable(true)]
        [DefaultValue(typeof(UpdatePanelRenderMode), "Block")]
        [Bindable(true)]
        [SRDescription("Manage_Master_CenterHeadLeftRenderMode", typeof(Properties.Resources))]
        [SRCategory("BackgroundCenterHeadControl")]
        [Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]
        [DisplayName("LeftRenderMode")]
        public UpdatePanelRenderMode CenterHeadLeftRenderMode
        {
            get
            {
                object o = this.ViewState["CenterHeadLeftRenderMode"];
                if (o == null) return UpdatePanelRenderMode.Block;
                return (UpdatePanelRenderMode)o;
            }
            set
            {
                this.ViewState["CenterHeadLeftRenderMode"] = value;
            }
        }
        /// <summary>
        /// 创建子控件事件。
        /// </summary>
        /// <remarks>创建子控件事件。</remarks>
        [Browsable(true)]
        [Category("Behavior")]
        [SRDescription("CreateChildControl", typeof(Properties.Resources))]
        public event EventHandler CreateChildControl
        {
            add
            {
                Events.AddHandler(_createChildControlObject, value);
            }
            remove
            {
                Events.RemoveHandler(_createChildControlObject, value);
            }
        }
        private static readonly object _createChildControlObject = new object();
        /// <summary>
        /// 创建子控件事件。
        /// </summary>
        /// <remarks>创建子控件事件。</remarks>
        /// <param name="e"></param>
        protected virtual void OnCreateChildControl(EventArgs e)
        {
            EventHandler handler = (EventHandler)Events[_createChildControlObject];
            if (handler != null)
            {
                handler(this, e);
            }
        }
        PlaceHolder _centerLeftPlaceHolder;
        /// <summary>
        /// 获取中间左边容器加载对象。
        /// </summary>
        /// <remarks>获取中间左边容器加载对象。</remarks>
        /// <value>System.Web.UI.WebControls.PlaceHolder</value>
        [Browsable(false)]
        public PlaceHolder CenterLeftPlaceHolder
        {
            get
            {
                if (_centerLeftPlaceHolder == null) _centerLeftPlaceHolder = new PlaceHolder();
                return _centerLeftPlaceHolder;
            }
        }
        /// <summary>
        /// 获取当前菜单的层次深度。
        /// </summary>
        /// <remarks>获取当前菜单的层次深度。</remarks>
        /// <value>int</value>
        [Browsable(false)]
        public int CurrentMenuLevel
        {
            get
            {
                object o = this.ViewState["CurrentMenuLevel"];
                if (o == null) return 0;
                return (int)o;
            }
        }
    }
}